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


Java Target.setAddress方法代码示例

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


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

示例1: newMockSender

import org.apache.qpid.proton.amqp.messaging.Target; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static ProtonSender newMockSender(final boolean drainFlag) {
    @SuppressWarnings("rawtypes")
    ArgumentCaptor<Handler> drainHandlerCaptor = ArgumentCaptor.forClass(Handler.class);
    Record attachments = mock(Record.class);
    ProtonSender sender = mock(ProtonSender.class);
    when(sender.attachments()).thenReturn(attachments);
    when(sender.isOpen()).thenReturn(Boolean.TRUE);
    when(sender.getCredit()).thenReturn(DEFAULT_CREDITS);
    when(sender.getQueued()).thenReturn(0);
    when(sender.getDrain()).thenReturn(drainFlag);
    when(sender.open()).then(invocation -> {
        drainHandlerCaptor.getValue().handle(sender);
        return sender;
    });
    when(sender.sendQueueDrainHandler(drainHandlerCaptor.capture())).then(invocation -> {
        return sender;
    });
    Target target = new Target();
    target.setAddress(DEFAULT_ADDRESS);
    when(sender.getTarget()).thenReturn(target);
    return sender;
}
 
开发者ID:eclipse,项目名称:hono,代码行数:24,代码来源:TestSupport.java

示例2: doOpen

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

示例3: createSender

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

示例4: newOutgoing

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

示例5: newIncoming

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

示例6: createSender

import org.apache.qpid.proton.amqp.messaging.Target; //导入方法依赖的package包/类
@Override
public ProtonSender createSender(String address, ProtonLinkOptions senderOptions) {
  Sender sender = session.sender(getOrCreateLinkName(senderOptions));

  Symbol[] outcomes = new Symbol[] { Accepted.DESCRIPTOR_SYMBOL, Rejected.DESCRIPTOR_SYMBOL,
      Released.DESCRIPTOR_SYMBOL, Modified.DESCRIPTOR_SYMBOL };
  Source source = new Source();
  source.setOutcomes(outcomes);

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

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

  ProtonSenderImpl s = new ProtonSenderImpl(sender);
  if (address == null) {
    s.setAnonymousSender(true);
  }

  s.openHandler((result) -> {
    LOG.trace("Sender open completed");
  });
  s.closeHandler((result) -> {
    if (result.succeeded()) {
      LOG.trace("Sender closed");
    } else {
      LOG.warn("Sender closed with error", result.cause());
    }
  });

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

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

示例7: createOutboundLink

import org.apache.qpid.proton.amqp.messaging.Target; //导入方法依赖的package包/类
@Override
public OutboundLink createOutboundLink(String address, OutboundLinkMode mode) throws NetworkException,
        MessagingException
{
    checkClosed();
    Sender sender;
    Source source = new Source();
    Target target = new Target();
    if (address == null || address.isEmpty() || address.equals("#"))
    {
        String temp = UUID.randomUUID().toString();
        sender = _ssn.sender(temp);
        target.setDynamic(true);
    }
    else
    {
        sender = _ssn.sender(address);
        target.setAddress(address);
    }
    sender.setTarget(target);
    sender.setSource(source);
    sender.setSenderSettleMode(mode == OutboundLinkMode.AT_MOST_ONCE ? SenderSettleMode.SETTLED
            : SenderSettleMode.UNSETTLED);
    sender.open();

    OutboundLinkImpl outLink = new OutboundLinkImpl(this, address, sender);
    outLink.setDynamicAddress(target.getDynamic());
    _links.put(sender, outLink);
    sender.setContext(outLink);
    _conn.write();
    return outLink;
}
 
开发者ID:rajith77,项目名称:splash,代码行数:33,代码来源:SessionImpl.java

示例8: createEndpoint

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

示例9: getTarget

import org.apache.qpid.proton.amqp.messaging.Target; //导入方法依赖的package包/类
@Override
public Target getTarget(String address) {
    Target target = new Target();
    target.setAddress(address);
    return target;
}
 
开发者ID:EnMasseProject,项目名称:enmasse,代码行数:7,代码来源:QueueTerminusFactory.java

示例10: newInstance

import org.apache.qpid.proton.amqp.messaging.Target; //导入方法依赖的package包/类
public Target newInstance(Object described)
{
    List l = (List) described;

    Target o = new Target();


    switch(7 - l.size())
    {

        case 0:
            Object val0 = l.get( 6 );
            if( val0 == null || val0.getClass().isArray() )
            {
                o.setCapabilities( (Symbol[]) val0 );
            }
            else
            {
                o.setCapabilities( (Symbol) val0 );
            }
        case 1:
            o.setDynamicNodeProperties( (Map) l.get( 5 ) );
        case 2:
            Boolean dynamic = (Boolean) l.get(4);
            o.setDynamic(dynamic == null ? false : dynamic);
        case 3:
            UnsignedInteger timeout = (UnsignedInteger) l.get(3);
            o.setTimeout(timeout == null ? UnsignedInteger.ZERO : timeout);
        case 4:
            Symbol expiryPolicy = (Symbol) l.get(2);
            o.setExpiryPolicy(expiryPolicy == null ? TerminusExpiryPolicy.SESSION_END : TerminusExpiryPolicy.valueOf(expiryPolicy));
        case 5:
            UnsignedInteger durable = (UnsignedInteger) l.get(1);
            o.setDurable(durable == null ? TerminusDurability.NONE : TerminusDurability.get(durable));
        case 6:
            o.setAddress( (String) l.get( 0 ) );
    }


    return o;
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:42,代码来源:TargetType.java


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