当前位置: 首页>>代码示例>>Java>>正文


Java Source.setAddress方法代码示例

本文整理汇总了Java中org.apache.qpid.proton.amqp.messaging.Source.setAddress方法的典型用法代码示例。如果您正苦于以下问题:Java Source.setAddress方法的具体用法?Java Source.setAddress怎么用?Java Source.setAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.qpid.proton.amqp.messaging.Source的用法示例。


在下文中一共展示了Source.setAddress方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testConsumeWhenOnlyAnycast

import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
@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();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:21,代码来源:BrokerDefinedMulticastConsumerTest.java

示例2: testConsumeWhenOnlyMulticast

import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
@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();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:21,代码来源:BrokerDefinedAnycastConsumerTest.java

示例3: doOpen

import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
@Override
protected void doOpen() {

    String sourceAddress = info.getName();
    if (info.isQueue()) {
        sourceAddress = connection.getTempQueuePrefix() + sourceAddress;
    } else {
        sourceAddress = connection.getTempQueuePrefix() + sourceAddress;
    }
    Source source = new Source();
    source.setAddress(sourceAddress);
    Target target = new Target();
    target.setDynamic(true);

    String senderName = sourceAddress;
    endpoint = session.getProtonSession().sender(senderName);
    endpoint.setSource(source);
    endpoint.setTarget(target);
    endpoint.setSenderSettleMode(SenderSettleMode.UNSETTLED);
    endpoint.setReceiverSettleMode(ReceiverSettleMode.FIRST);

    this.connection.addTemporaryDestination(this);
}
 
开发者ID:fusesource,项目名称:hawtjms,代码行数:24,代码来源:AmqpTemporaryDestination.java

示例4: doOpen

import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
@Override
protected void doOpen() {
    JmsDestination destination = info.getDestination();

    String destnationName = session.getQualifiedName(destination);
    String sourceAddress = getProducerId().toString();
    Source source = new Source();
    source.setAddress(sourceAddress);
    Target target = new Target();
    target.setAddress(destnationName);

    String senderName = sourceAddress + ":" + destnationName != null ? destnationName : "Anonymous";
    endpoint = session.getProtonSession().sender(senderName);
    endpoint.setSource(source);
    endpoint.setTarget(target);
    if (presettle) {
        endpoint.setSenderSettleMode(SenderSettleMode.SETTLED);
    } else {
        endpoint.setSenderSettleMode(SenderSettleMode.UNSETTLED);
    }
    endpoint.setReceiverSettleMode(ReceiverSettleMode.FIRST);
}
 
开发者ID:fusesource,项目名称:hawtjms,代码行数:23,代码来源:AmqpFixedProducer.java

示例5: testOnLinkAttachClosesSenderWithoutAppropriateReplyAddress

import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
/**
 * Verifies that the endpoint closes a sender that does not contain a source address
 * that is not suitable as a reply-to-address.
 */
@Test
public void testOnLinkAttachClosesSenderWithoutAppropriateReplyAddress() {

    Source source = new Source();
    source.setAddress("endpoint/" + Constants.DEFAULT_TENANT); // not a suitable reply-to-address: missing resource ID
    when(sender.getRemoteSource()).thenReturn(source);
    RequestResponseEndpoint<ServiceConfigProperties> endpoint = getEndpoint(true);

    endpoint.onLinkAttach(connection, sender, resource);

    verify(sender).setCondition(any());
    verify(sender).close();
}
 
开发者ID:eclipse,项目名称:hono,代码行数:18,代码来源:RequestResponseEndpointTest.java

示例6: createSender

import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
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();
}
 
开发者ID:EnMasseProject,项目名称:enmasse,代码行数:14,代码来源:LinkInitiator.java

示例7: createSender

import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
private void createSender(ProtonConnection connection, ProtonSender sender) {
    Source source = (Source) sender.getRemoteSource();
    if (source.getDynamic()) {
        String replyAddress = UUID.randomUUID().toString();
        replyHandlers.put(replyAddress, new HandlerContext(connection, sender, replyAddress));
        sender.closeHandler(res -> replyHandlers.remove(replyAddress));

        source.setAddress(replyAddress);
        sender.setSource(source);
    }
    sender.open();
}
 
开发者ID:EnMasseProject,项目名称:enmasse,代码行数:13,代码来源:AMQPServer.java

示例8: newOutgoing

import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
public Sender newOutgoing(Session ssn, String remote, String local) {
    Sender snd = ssn.sender(String.format("%s-%s", local, remote));
    Source src = new Source();
    src.setAddress(local);
    snd.setSource(src);
    Target tgt = new Target();
    tgt.setAddress(remote);
    snd.setTarget(tgt);
    return snd;
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:11,代码来源:Pool.java

示例9: newIncoming

import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
public Receiver newIncoming(Session ssn, String remote, String local) {
    Receiver rcv = ssn.receiver(String.format("%s-%s", remote, local));
    Source src = new Source();
    src.setAddress(remote);
    rcv.setSource(src);
    Target tgt = new Target();
    tgt.setAddress(remote);
    rcv.setTarget(tgt);
    return rcv;
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:11,代码来源:Pool.java

示例10: testClientIdIsSetInSubscriptionList

import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
@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();
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:28,代码来源:AmqpReceiverTest.java

示例11: createNonSharedSource

import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
private Source createNonSharedSource(TerminusDurability terminusDurability) {
   Source source = new Source();
   source.setAddress(address.toString());
   source.setCapabilities(TOPIC_CAPABILITY);
   source.setDurable(terminusDurability);
   return source;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:8,代码来源:ClientDefinedMultiConsumerTest.java

示例12: createSharedSource

import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
private Source createSharedSource(TerminusDurability terminusDurability) {
   Source source = new Source();
   source.setAddress(address.toString());
   source.setCapabilities(TOPIC_CAPABILITY, SHARED);
   source.setDurable(terminusDurability);
   return source;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:8,代码来源:ClientDefinedMultiConsumerTest.java

示例13: createSharedGlobalSource

import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
private Source createSharedGlobalSource(TerminusDurability terminusDurability) {
   Source source = new Source();
   source.setAddress(address.toString());
   source.setCapabilities(TOPIC_CAPABILITY, SHARED, GLOBAL);
   source.setDurable(terminusDurability);
   return source;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:8,代码来源:ClientDefinedMultiConsumerTest.java

示例14: createReceiver

import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
@Override
public ProtonReceiver createReceiver(String address, ProtonLinkOptions receiverOptions) {
  Receiver receiver = session.receiver(getOrCreateLinkName(receiverOptions));

  Symbol[] outcomes = new Symbol[] { Accepted.DESCRIPTOR_SYMBOL, Rejected.DESCRIPTOR_SYMBOL,
      Released.DESCRIPTOR_SYMBOL, Modified.DESCRIPTOR_SYMBOL };

  Source source = new Source();
  source.setAddress(address);
  source.setOutcomes(outcomes);
  source.setDefaultOutcome(Released.getInstance());

  Target target = new Target();

  receiver.setSource(source);
  receiver.setTarget(target);

  ProtonReceiverImpl r = new ProtonReceiverImpl(receiver);
  r.openHandler((result) -> {
    LOG.trace("Receiver open completed");
  });
  r.closeHandler((result) -> {
    if (result.succeeded()) {
      LOG.trace("Receiver closed");
    } else {
      LOG.warn("Receiver closed with error", result.cause());
    }
  });

  // Default to at-least-once
  r.setQoS(ProtonQoS.AT_LEAST_ONCE);

  return r;
}
 
开发者ID:vert-x3,项目名称:vertx-proton,代码行数:35,代码来源:ProtonSessionImpl.java

示例15: createEndpoint

import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
@Override
protected Sender createEndpoint(JmsProducerInfo resourceInfo) {
    JmsDestination destination = resourceInfo.getDestination();
    AmqpConnection connection = getParent().getConnection();

    String targetAddress = AmqpDestinationHelper.INSTANCE.getDestinationAddress(destination, connection);

    Symbol[] outcomes = new Symbol[]{ Accepted.DESCRIPTOR_SYMBOL, Rejected.DESCRIPTOR_SYMBOL, Released.DESCRIPTOR_SYMBOL, Modified.DESCRIPTOR_SYMBOL };
    String sourceAddress = resourceInfo.getId().toString();
    Source source = new Source();
    source.setAddress(sourceAddress);
    source.setOutcomes(outcomes);
    // TODO: default outcome. Accepted normally, Rejected for transaction controller?

    Target target = new Target();
    target.setAddress(targetAddress);
    Symbol typeCapability =  AmqpDestinationHelper.INSTANCE.toTypeCapability(destination);
    if (typeCapability != null) {
        target.setCapabilities(typeCapability);
    }

    String senderName = "qpid-jms:sender:" + sourceAddress + ":" + targetAddress;

    Sender sender = getParent().getEndpoint().sender(senderName);
    sender.setSource(source);
    sender.setTarget(target);
    if (resourceInfo.isPresettle()) {
        sender.setSenderSettleMode(SenderSettleMode.SETTLED);
    } else {
        sender.setSenderSettleMode(SenderSettleMode.UNSETTLED);
    }
    sender.setReceiverSettleMode(ReceiverSettleMode.FIRST);

    if (!connection.getProperties().isDelayedDeliverySupported()) {
        validateDelayedDeliveryLinkCapability = true;
        sender.setDesiredCapabilities(new Symbol[] { AmqpSupport.DELAYED_DELIVERY });
    }

    return sender;
}
 
开发者ID:apache,项目名称:qpid-jms,代码行数:41,代码来源:AmqpProducerBuilder.java


注:本文中的org.apache.qpid.proton.amqp.messaging.Source.setAddress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。