Java Code Examples for org.apache.qpid.proton.engine.Sender#setReceiverSettleMode()
The following examples show how to use
org.apache.qpid.proton.engine.Sender#setReceiverSettleMode() .
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: 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 4
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; }
Example 5
Source File: LinkTest.java From qpid-proton-j with Apache License 2.0 | 4 votes |
@Test public void testMaxMessageSizeValue() throws Exception { LOGGER.fine(bold("======== About to create transports")); Transport clientTransport = Proton.transport(); getClient().setTransport(clientTransport); ProtocolTracerEnabler.setProtocolTracer(clientTransport, TestLoggingHelper.CLIENT_PREFIX); Transport serverTransport = Proton.transport(); getServer().setTransport(serverTransport); ProtocolTracerEnabler.setProtocolTracer(serverTransport, " " + TestLoggingHelper.SERVER_PREFIX); doOutputInputCycle(); Connection clientConnection = Proton.connection(); getClient().setConnection(clientConnection); clientTransport.bind(clientConnection); Connection serverConnection = Proton.connection(); getServer().setConnection(serverConnection); serverTransport.bind(serverConnection); LOGGER.fine(bold("======== About to open connections")); clientConnection.open(); serverConnection.open(); doOutputInputCycle(); LOGGER.fine(bold("======== About to open sessions")); Session clientSession = clientConnection.session(); getClient().setSession(clientSession); clientSession.open(); pumpClientToServer(); Session serverSession = serverConnection.sessionHead(of(UNINITIALIZED), of(ACTIVE)); getServer().setSession(serverSession); serverSession.open(); pumpServerToClient(); LOGGER.fine(bold("======== About to create receiver")); Source clientSource = new Source(); getClient().setSource(clientSource); clientSource.setAddress(_sourceAddress); Target clientTarget = new Target(); getClient().setTarget(clientTarget); clientTarget.setAddress(null); Receiver clientReceiver = clientSession.receiver("link1"); getClient().setReceiver(clientReceiver); clientReceiver.setTarget(clientTarget); clientReceiver.setSource(clientSource); clientReceiver.setReceiverSettleMode(ReceiverSettleMode.FIRST); clientReceiver.setSenderSettleMode(SenderSettleMode.UNSETTLED); // Set the local link max-message-size assertNull("Expected no value to be set", clientReceiver.getMaxMessageSize()); clientReceiver.setMaxMessageSize(CLIENT_MAX_MSG_SIZE); assertEquals("Expected value to be set", CLIENT_MAX_MSG_SIZE, clientReceiver.getMaxMessageSize()); clientReceiver.open(); pumpClientToServer(); LOGGER.fine(bold("======== About to set up implicitly created sender")); Sender serverSender = (Sender) getServer().getConnection().linkHead(of(UNINITIALIZED), of(ACTIVE)); getServer().setSender(serverSender); serverSender.setReceiverSettleMode(serverSender.getRemoteReceiverSettleMode()); serverSender.setSenderSettleMode(serverSender.getRemoteSenderSettleMode()); org.apache.qpid.proton.amqp.transport.Source serverRemoteSource = serverSender.getRemoteSource(); serverSender.setSource(serverRemoteSource); assertEquals("Expected value to be set", CLIENT_MAX_MSG_SIZE, serverSender.getRemoteMaxMessageSize()); // Set the local link max-message-size assertNull("Expected no value to be set", serverSender.getMaxMessageSize()); serverSender.setMaxMessageSize(SERVER_MAX_MSG_SIZE); assertEquals("Expected value to be set", SERVER_MAX_MSG_SIZE, serverSender.getMaxMessageSize()); serverSender.open(); assertNull("Expected no value to be present yet", clientReceiver.getRemoteMaxMessageSize()); pumpServerToClient(); assertEquals("Expected value to be set", SERVER_MAX_MSG_SIZE, clientReceiver.getRemoteMaxMessageSize()); }