org.apache.qpid.proton.amqp.messaging.Source.setAddress()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中org.apache.qpid.proton.amqp.messaging.Source.setAddress()方法的一些代码示例,展示了Source.setAddress()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Source.setAddress()方法的具体详情如下:
包路径:org.apache.qpid.proton.amqp.messaging.Source
类名称:Source
方法名:setAddress

Source.setAddress介绍

暂无

代码示例

代码示例来源:origin: vert-x3/vertx-examples

remoteSource.setAddress(dynamicAddress);

代码示例来源:origin: EnMasseProject/enmasse

@Override
public Source getSource(String address) {
  Source source = new Source();
  source.setAddress(address);
  return source;
}

代码示例来源:origin: Azure/azure-iot-sdk-java

@Override
public void onLinkInit(Event event)
{
  // Codes_SRS_SERVICE_SDK_JAVA_AMQPFEEDBACKRECEIVEDHANDLER_12_015: [The event handler shall create a new Target (Proton) object using the given endpoint address]
  // Codes_SRS_SERVICE_SDK_JAVA_AMQPFEEDBACKRECEIVEDHANDLER_12_016: [The event handler shall get the Link (Proton) object and set its target to the created Target (Proton) object]
  Link link = event.getLink();
  if (event.getLink().getName().equals(RECEIVE_TAG))
  {
    Target t = new Target();
    t.setAddress(ENDPOINT);
    Source source = new Source();
    source.setAddress(ENDPOINT);
    link.setTarget(t);
    link.setSource(source);
  }
}

代码示例来源:origin: Azure/azure-iot-sdk-java

@Override
public void onLinkInit(Event event)
{
  // Codes_SRS_SERVICE_SDK_JAVA_AMQPFILEUPLOADNOTIFICATIONRECEIVEDHANDLER_25_015: [The event handler shall create a new Target (Proton) object using the given endpoint address]
  // Codes_SRS_SERVICE_SDK_JAVA_AMQPFILEUPLOADNOTIFICATIONRECEIVEDHANDLER_25_016: [The event handler shall get the Link (Proton) object and set its target to the created Target (Proton) object]
  Link link = event.getLink();
  if (event.getLink().getName().equals(FILE_NOTIFICATION_RECEIVE_TAG))
  {
    Target t = new Target();
    t.setAddress(FILENOTIFICATION_ENDPOINT);
    Source source = new Source();
    source.setAddress(FILENOTIFICATION_ENDPOINT);
    link.setTarget(t);
    link.setSource(source);
  }
}

代码示例来源:origin: com.microsoft.azure.iothub-java-client/iothub-java-device-client

/**
 * Event handler for the link init event. Sets the proper target address on the link.
 * @param event The Proton Event object.
 */
@Override
public void onLinkInit(Event event)
{
  Link link = event.getLink();
  if(link.getName().equals(sendTag))
  {
    // Codes_SRS_AMQPSIOTHUBCONNECTION_15_043: [If the link is the Sender link, the event handler shall create a new Target (Proton) object using the sender endpoint address member variable.]
    Target t = new Target();
    t.setAddress(this.sendEndpoint);
    // Codes_SRS_AMQPSIOTHUBCONNECTION_15_044: [If the link is the Sender link, the event handler shall set its target to the created Target (Proton) object.]
    link.setTarget(t);
    // Codes_SRS_AMQPSIOTHUBCONNECTION_14_045: [If the link is the Sender link, the event handler shall set the SenderSettleMode to UNSETTLED.]
    link.setSenderSettleMode(SenderSettleMode.UNSETTLED);
  }
  else
  {
    // Codes_SRS_AMQPSIOTHUBCONNECTION_14_046: [If the link is the Receiver link, the event handler shall create a new Source (Proton) object using the receiver endpoint address member variable.]
    Source source = new Source();
    source.setAddress(this.receiveEndpoint);
    // Codes_SRS_AMQPSIOTHUBCONNECTION_14_047: [If the link is the Receiver link, the event handler shall set its source to the created Source (Proton) object.]
    link.setSource(source);
  }
}

代码示例来源:origin: apache/activemq-artemis

private Source createNonSharedSource(TerminusDurability terminusDurability) {
 Source source = new Source();
 source.setAddress(address.toString());
 source.setCapabilities(TOPIC_CAPABILITY);
 source.setDurable(terminusDurability);
 return source;
}

代码示例来源:origin: apache/activemq-artemis

private Source createSharedSource(TerminusDurability terminusDurability) {
 Source source = new Source();
 source.setAddress(address.toString());
 source.setCapabilities(TOPIC_CAPABILITY, SHARED);
 source.setDurable(terminusDurability);
 return source;
}

代码示例来源:origin: apache/activemq-artemis

private Source createSharedGlobalSource(TerminusDurability terminusDurability) {
   Source source = new Source();
   source.setAddress(address.toString());
   source.setCapabilities(TOPIC_CAPABILITY, SHARED, GLOBAL);
   source.setDurable(terminusDurability);
   return source;
  }
}

代码示例来源:origin: Azure/azure-event-hubs-java

public RequestResponseChannel(
    final String linkName,
    final String path,
    final Session session) {
  this.replyTo = path.replace("$", "") + "-client-reply-to";
  this.openRefCount = new AtomicInteger(2);
  this.closeRefCount = new AtomicInteger(2);
  this.inflightRequests = new HashMap<>();
  this.requestId = new AtomicLong(0);
  this.sendLink = session.sender(linkName + ":sender");
  final Target target = new Target();
  target.setAddress(path);
  this.sendLink.setTarget(target);
  sendLink.setSource(new Source());
  this.sendLink.setSenderSettleMode(SenderSettleMode.SETTLED);
  BaseHandler.setHandler(this.sendLink, new SendLinkHandler(new RequestHandler()));
  this.receiveLink = session.receiver(linkName + ":receiver");
  final Source source = new Source();
  source.setAddress(path);
  this.receiveLink.setSource(source);
  final Target receiverTarget = new Target();
  receiverTarget.setAddress(this.replyTo);
  this.receiveLink.setTarget(receiverTarget);
  this.receiveLink.setSenderSettleMode(SenderSettleMode.SETTLED);
  this.receiveLink.setReceiverSettleMode(ReceiverSettleMode.SECOND);
  BaseHandler.setHandler(this.receiveLink, new ReceiveLinkHandler(new ResponseHandler()));
}

代码示例来源:origin: org.apache.qpid/proton-j-impl

public Receiver create(Session session)
  {
    Receiver receiver = session.receiver(_path);
    Source source = new Source();
    source.setAddress(_path);
    receiver.setSource(source);
    // the C implemenation does this:
    Target target = new Target();
    target.setAddress(_path);
    receiver.setTarget(target);
    if (getIncomingWindow() > 0)
    {
      // use explicit settlement via dispositions (not pre-settled)
      receiver.setSenderSettleMode(SenderSettleMode.UNSETTLED);  // desired
      receiver.setReceiverSettleMode(ReceiverSettleMode.SECOND);
    }
    return receiver;
  }
}

代码示例来源:origin: EnMasseProject/enmasse

private void createSender(org.apache.qpid.proton.engine.Session session) throws Exception {
   Sender sender = session.sender(subscriberInfo.getClientId());
   Target target = new Target();
   target.setAddress(subscriberInfo.getClientAddress());
   sender.setTarget(target);

   Source source = new Source();
   source.setAddress(subscriberInfo.getClientAddress());
   source.setDurable(TerminusDurability.UNSETTLED_STATE);
   sender.setSource(source);

   sender.open();
  }
}

代码示例来源:origin: org.apache.qpid/proton-j-impl

public Sender create(Session session)
  {
    Sender sender = session.sender(_path);
    Target target = new Target();
    target.setAddress(_path);
    sender.setTarget(target);
    // the C implemenation does this:
    Source source = new Source();
    source.setAddress(_path);
    sender.setSource(source);
    if (getOutgoingWindow() > 0)
    {
      // use explicit settlement via dispositions (not pre-settled)
      sender.setSenderSettleMode(SenderSettleMode.UNSETTLED);
      sender.setReceiverSettleMode(ReceiverSettleMode.SECOND);  // desired
    }
    return sender;
  }
}

代码示例来源:origin: com.microsoft.azure.iot/proton-j-azure-iot

public Sender create(Session session)
  {
    Sender sender = session.sender(_path);
    Target target = new Target();
    target.setAddress(_path);
    sender.setTarget(target);
    // the C implemenation does this:
    Source source = new Source();
    source.setAddress(_path);
    sender.setSource(source);
    if (getOutgoingWindow() > 0)
    {
      // use explicit settlement via dispositions (not pre-settled)
      sender.setSenderSettleMode(SenderSettleMode.UNSETTLED);
      sender.setReceiverSettleMode(ReceiverSettleMode.SECOND);  // desired
    }
    return sender;
  }
}

代码示例来源:origin: com.microsoft.azure.iot/proton-j-azure-iot

public Receiver create(Session session)
  {
    Receiver receiver = session.receiver(_path);
    Source source = new Source();
    source.setAddress(_path);
    receiver.setSource(source);
    // the C implemenation does this:
    Target target = new Target();
    target.setAddress(_path);
    receiver.setTarget(target);
    if (getIncomingWindow() > 0)
    {
      // use explicit settlement via dispositions (not pre-settled)
      receiver.setSenderSettleMode(SenderSettleMode.UNSETTLED);  // desired
      receiver.setReceiverSettleMode(ReceiverSettleMode.SECOND);
    }
    return receiver;
  }
}

代码示例来源:origin: org.apache.activemq/artemis-proton-plug

@Override
  public AMQPClientReceiverContext createReceiver(String name, String address) throws ActiveMQAMQPException {
   FutureRunnable futureRunnable = new FutureRunnable(1);

   ProtonClientReceiverContext amqpReceiver;

   synchronized (connection.getLock()) {
     Receiver receiver = session.receiver(name);
     Source source = new Source();
     source.setAddress(address);
     receiver.setSource(source);
     amqpReceiver = new ProtonClientReceiverContext(sessionSPI, connection, this, receiver);
     receiver.setContext(amqpReceiver);
     amqpReceiver.afterInit(futureRunnable);
     receiver.open();
   }

   connection.flush();

   waitWithTimeout(futureRunnable);

   return amqpReceiver;

  }
}

代码示例来源:origin: apache/activemq-artemis

source.setAddress(getQueueName());
source.setFilter(filters);
source.setDurable(TerminusDurability.NONE);

代码示例来源:origin: apache/activemq-artemis

source.setAddress(getQueueName());
source.setFilter(filters);
source.setDurable(TerminusDurability.NONE);

代码示例来源:origin: apache/activemq-artemis

@Test(timeout = 60000)
public void testConsumeWhenOnlyMulticast() throws Exception {
 server.addAddressInfo(new AddressInfo(address, RoutingType.MULTICAST));
 sendMessages(address.toString(), 1);
 AmqpClient client = createAmqpClient();
 AmqpConnection connection = addConnection(client.connect());
 AmqpSession session = connection.createSession();
 Source jmsSource = createJmsSource(false);
 jmsSource.setAddress(address.toString());
 try {
   session.createReceiver(jmsSource);
   fail("should throw exception");
 } catch (Exception e) {
   //ignore
 }
 connection.close();
}

代码示例来源:origin: apache/activemq-artemis

@Test(timeout = 60000)
public void testConsumeWhenOnlyAnycast() throws Exception {
 server.addAddressInfo(new AddressInfo(address, RoutingType.ANYCAST));
 sendMessages(address.toString(), 1);
 AmqpClient client = createAmqpClient();
 AmqpConnection connection = addConnection(client.connect());
 AmqpSession session = connection.createSession();
 Source jmsSource = createJmsSource(true);
 jmsSource.setAddress(address.toString());
 try {
   session.createReceiver(jmsSource);
   fail("should throw exception");
 } catch (Exception e) {
   //ignore
 }
 connection.close();
}

代码示例来源:origin: apache/activemq-artemis

@Test(timeout = 60000)
public void testClientIdIsSetInSubscriptionList() throws Exception {
 server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("mytopic"), RoutingType.ANYCAST));
 AmqpClient client = createAmqpClient();
 AmqpConnection connection = addConnection(client.connect());
 connection.setContainerId("testClient");
 connection.connect();
 try {
   AmqpSession session = connection.createSession();
   Source source = new Source();
   source.setDurable(TerminusDurability.UNSETTLED_STATE);
   source.setCapabilities(Symbol.getSymbol("topic"));
   source.setAddress("mytopic");
   session.createReceiver(source, "testSub");
   SimpleString fo = new SimpleString("testClient.testSub:mytopic");
   assertNotNull(server.locateQueue(fo));
 } catch (Exception e) {
   e.printStackTrace();
 } finally {
   connection.close();
 }
}

相关文章