Java Code Examples for org.apache.qpid.proton.engine.Sender#setTarget()
The following examples show how to use
org.apache.qpid.proton.engine.Sender#setTarget() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AmqpTransactionCoordinator.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Override protected void doOpen() { Coordinator coordinator = new Coordinator(); coordinator.setCapabilities(TxnCapability.LOCAL_TXN); Source source = new Source(); String coordinatorName = "qpid-jms:coordinator:" + session.getConnection().getConnectionId(); Sender sender = session.getEndpoint().sender(coordinatorName); sender.setSource(source); sender.setTarget(coordinator); sender.setSenderSettleMode(SenderSettleMode.UNSETTLED); sender.setReceiverSettleMode(ReceiverSettleMode.FIRST); setEndpoint(sender); super.doOpen(); }
Example 2
Source File: AmqpTransactionCoordinatorBuilder.java From qpid-jms with Apache License 2.0 | 6 votes |
@Override protected Sender createEndpoint(JmsSessionInfo resourceInfo) { Coordinator coordinator = new Coordinator(); coordinator.setCapabilities(TxnCapability.LOCAL_TXN); Symbol[] outcomes = new Symbol[]{ Accepted.DESCRIPTOR_SYMBOL, Rejected.DESCRIPTOR_SYMBOL, Released.DESCRIPTOR_SYMBOL, Modified.DESCRIPTOR_SYMBOL }; Source source = new Source(); source.setOutcomes(outcomes); String coordinatorName = "qpid-jms:coordinator:" + resourceInfo.getId().toString(); Sender sender = getParent().getSession().getEndpoint().sender(coordinatorName); sender.setSource(source); sender.setTarget(coordinator); sender.setSenderSettleMode(SenderSettleMode.UNSETTLED); sender.setReceiverSettleMode(ReceiverSettleMode.FIRST); return sender; }
Example 3
Source File: Pool.java From qpid-proton-j with Apache License 2.0 | 5 votes |
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; }
Example 4
Source File: ProtonSessionImpl.java From vertx-proton with Apache License 2.0 | 5 votes |
@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); if(senderOptions.isDynamic()) { target.setDynamic(true); } 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; }
Example 5
Source File: AmqpTemporaryDestinationBuilder.java From qpid-jms with Apache License 2.0 | 5 votes |
@Override protected Sender createEndpoint(JmsTemporaryDestination resourceInfo) { // Form a link name, use the local generated name with a prefix to aid debugging String localDestinationName = resourceInfo.getAddress(); String senderLinkName = null; if (resourceInfo.isQueue()) { senderLinkName = "qpid-jms:" + TEMP_QUEUE_CREATOR + localDestinationName; } else { senderLinkName = "qpid-jms:" + TEMP_TOPIC_CREATOR + localDestinationName; } // Just use a bare Source, this is a producer which // wont send anything and the link name is unique. Source source = new Source(); Target target = new Target(); target.setDynamic(true); target.setDurable(TerminusDurability.NONE); target.setExpiryPolicy(TerminusExpiryPolicy.LINK_DETACH); // Set the dynamic node lifetime-policy Map<Symbol, Object> dynamicNodeProperties = new HashMap<Symbol, Object>(); dynamicNodeProperties.put(DYNAMIC_NODE_LIFETIME_POLICY, DeleteOnClose.getInstance()); target.setDynamicNodeProperties(dynamicNodeProperties); // Set the capability to indicate the node type being created if (resourceInfo.isQueue()) { target.setCapabilities(AmqpDestinationHelper.TEMP_QUEUE_CAPABILITY); } else { target.setCapabilities(AmqpDestinationHelper.TEMP_TOPIC_CAPABILITY); } Sender sender = getParent().getEndpoint().sender(senderLinkName); sender.setSource(source); sender.setTarget(target); sender.setSenderSettleMode(SenderSettleMode.UNSETTLED); sender.setReceiverSettleMode(ReceiverSettleMode.FIRST); return sender; }
Example 6
Source File: AmqpProducerBuilder.java From qpid-jms with Apache License 2.0 | 5 votes |
@Override protected Sender createEndpoint(JmsProducerInfo resourceInfo) { JmsDestination destination = resourceInfo.getDestination(); AmqpConnection connection = getParent().getConnection(); String targetAddress = AmqpDestinationHelper.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.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; }