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


Java Receiver.setTarget方法代码示例

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


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

示例1: addReceiver

import org.apache.qpid.proton.engine.Receiver; //导入方法依赖的package包/类
public void addReceiver(Receiver receiver) throws Exception {
   try {
      ProtonServerReceiverContext protonReceiver = new ProtonServerReceiverContext(sessionSPI, connection, this, receiver);
      protonReceiver.initialise();
      receivers.put(receiver, protonReceiver);
      ServerProducer serverProducer = new ServerProducerImpl(receiver.getName(), "AMQP", receiver.getTarget().getAddress());
      sessionSPI.addProducer(serverProducer);
      receiver.setContext(protonReceiver);
      connection.lock();
      try {
         receiver.open();
      } finally {
         connection.unlock();
      }
   } catch (ActiveMQAMQPException e) {
      receivers.remove(receiver);
      receiver.setTarget(null);
      receiver.setCondition(new ErrorCondition(e.getAmqpError(), e.getMessage()));
      connection.lock();
      try {
         receiver.close();
      } finally {
         connection.unlock();
      }
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:27,代码来源:AMQPSessionContext.java

示例2: newIncoming

import org.apache.qpid.proton.engine.Receiver; //导入方法依赖的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

示例3: createReceiver

import org.apache.qpid.proton.engine.Receiver; //导入方法依赖的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

示例4: createEndpoint

import org.apache.qpid.proton.engine.Receiver; //导入方法依赖的package包/类
@Override
protected Receiver createEndpoint(JmsSessionInfo resourceInfo) {
    Receiver receiver = getParent().getEndpoint().receiver(linkName);
    receiver.setTarget(new Target());
    receiver.setSenderSettleMode(SenderSettleMode.UNSETTLED);
    receiver.setReceiverSettleMode(ReceiverSettleMode.FIRST);

    if (!hasClientID) {
      // We are trying to unsubscribe a 'global' shared subs using a 'null source lookup', add link
      // desired capabilities as hints to the peer to consider this when trying to attach the link.
      receiver.setDesiredCapabilities(new Symbol[] { AmqpSupport.SHARED, AmqpSupport.GLOBAL });
    }

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

示例5: createInboundLink

import org.apache.qpid.proton.engine.Receiver; //导入方法依赖的package包/类
@Override
public InboundLink createInboundLink(String address, InboundLinkMode mode, CreditMode creditMode)
        throws NetworkException, MessagingException
{
    Receiver receiver;
    Source source = new Source();
    Target target = new Target();
    if (address == null || address.isEmpty() || address.equals("#"))
    {
        String temp = UUID.randomUUID().toString();
        receiver = _ssn.receiver(temp);
        source.setDynamic(true);
    }
    else
    {
        receiver = _ssn.receiver(address);
        source.setAddress(address);
    }
    receiver.setSource(source);
    receiver.setTarget(target);
    switch (mode)
    {
    case AT_MOST_ONCE:
        receiver.setReceiverSettleMode(ReceiverSettleMode.FIRST);
        receiver.setSenderSettleMode(SenderSettleMode.SETTLED);
        break;
    case AT_LEAST_ONCE:
        receiver.setReceiverSettleMode(ReceiverSettleMode.FIRST);
        receiver.setSenderSettleMode(SenderSettleMode.UNSETTLED);
        break;
    case EXACTLY_ONCE:
        receiver.setReceiverSettleMode(ReceiverSettleMode.SECOND);
        receiver.setSenderSettleMode(SenderSettleMode.UNSETTLED);
        break;
    }
    receiver.open();

    InboundLinkImpl inLink = new InboundLinkImpl(this, address, receiver, creditMode);
    inLink.setDynamicAddress(source.getDynamic());
    _links.put(receiver, inLink);
    receiver.setContext(inLink);
    _conn.write();
    return inLink;
}
 
开发者ID:rajith77,项目名称:splash,代码行数:45,代码来源:SessionImpl.java

示例6: createEndpoint

import org.apache.qpid.proton.engine.Receiver; //导入方法依赖的package包/类
@Override
protected Receiver createEndpoint(JmsConsumerInfo resourceInfo) {
    JmsDestination destination = resourceInfo.getDestination();
    String address = AmqpDestinationHelper.INSTANCE.getDestinationAddress(destination, getParent().getConnection());

    Source source = new Source();
    source.setAddress(address);
    Target target = new Target();

    configureSource(source);

    String receiverLinkName = null;
    String subscriptionName = resourceInfo.getSubscriptionName();
    if (subscriptionName != null && !subscriptionName.isEmpty()) {
        AmqpConnection connection = getParent().getConnection();

        if (resourceInfo.isShared() && !connection.getProperties().isSharedSubsSupported()) {
            validateSharedSubsLinkCapability = true;
        }

        AmqpSubscriptionTracker subTracker = connection.getSubTracker();

        // Validate subscriber type allowed given existing active subscriber types.
        if (resourceInfo.isShared() && resourceInfo.isDurable()) {
            if(subTracker.isActiveExclusiveDurableSub(subscriptionName)) {
                // Don't allow shared sub if there is already an active exclusive durable sub
                throw new JMSRuntimeException("A non-shared durable subscription is already active with name '" + subscriptionName + "'");
            }
        } else if (!resourceInfo.isShared() && resourceInfo.isDurable()) {
            if (subTracker.isActiveExclusiveDurableSub(subscriptionName)) {
                // Exclusive durable sub is already active
                throw new JMSRuntimeException("A non-shared durable subscription is already active with name '" + subscriptionName + "'");
            } else if (subTracker.isActiveSharedDurableSub(subscriptionName)) {
                // Don't allow exclusive durable sub if there is already an active shared durable sub
                throw new JMSRuntimeException("A shared durable subscription is already active with name '" + subscriptionName + "'");
            }
        }

        // Get the link name for the subscription. Throws if certain further validations fail.
        receiverLinkName = subTracker.reserveNextSubscriptionLinkName(subscriptionName, resourceInfo);
    }

    if(receiverLinkName == null) {
        receiverLinkName = "qpid-jms:receiver:" + resourceInfo.getId() + ":" + address;
    }

    Receiver receiver = getParent().getEndpoint().receiver(receiverLinkName);
    receiver.setSource(source);
    receiver.setTarget(target);
    if (resourceInfo.isBrowser() || resourceInfo.isPresettle()) {
        receiver.setSenderSettleMode(SenderSettleMode.SETTLED);
    } else {
        receiver.setSenderSettleMode(SenderSettleMode.UNSETTLED);
    }
    receiver.setReceiverSettleMode(ReceiverSettleMode.FIRST);

    if(validateSharedSubsLinkCapability) {
        receiver.setDesiredCapabilities(new Symbol[] { AmqpSupport.SHARED_SUBS });
    }

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


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