remoteSource.setAddress(dynamicAddress);
@Override public Source getSource(String address) { Source source = new Source(); source.setAddress(address); return source; }
@Override public void onLinkInit(Event event) { // Codes_SRS_SERVICE_SDK_JAVA_AMQPFEEDBACKRECEIVEDHANDLER_12_015: [The event handler shall create a new Target (Proton) object using the given endpoint address] // Codes_SRS_SERVICE_SDK_JAVA_AMQPFEEDBACKRECEIVEDHANDLER_12_016: [The event handler shall get the Link (Proton) object and set its target to the created Target (Proton) object] Link link = event.getLink(); if (event.getLink().getName().equals(RECEIVE_TAG)) { Target t = new Target(); t.setAddress(ENDPOINT); Source source = new Source(); source.setAddress(ENDPOINT); link.setTarget(t); link.setSource(source); } }
@Override public void onLinkInit(Event event) { // Codes_SRS_SERVICE_SDK_JAVA_AMQPFILEUPLOADNOTIFICATIONRECEIVEDHANDLER_25_015: [The event handler shall create a new Target (Proton) object using the given endpoint address] // Codes_SRS_SERVICE_SDK_JAVA_AMQPFILEUPLOADNOTIFICATIONRECEIVEDHANDLER_25_016: [The event handler shall get the Link (Proton) object and set its target to the created Target (Proton) object] Link link = event.getLink(); if (event.getLink().getName().equals(FILE_NOTIFICATION_RECEIVE_TAG)) { Target t = new Target(); t.setAddress(FILENOTIFICATION_ENDPOINT); Source source = new Source(); source.setAddress(FILENOTIFICATION_ENDPOINT); link.setTarget(t); link.setSource(source); } }
/** * Event handler for the link init event. Sets the proper target address on the link. * @param event The Proton Event object. */ @Override public void onLinkInit(Event event) { Link link = event.getLink(); if(link.getName().equals(sendTag)) { // Codes_SRS_AMQPSIOTHUBCONNECTION_15_043: [If the link is the Sender link, the event handler shall create a new Target (Proton) object using the sender endpoint address member variable.] Target t = new Target(); t.setAddress(this.sendEndpoint); // Codes_SRS_AMQPSIOTHUBCONNECTION_15_044: [If the link is the Sender link, the event handler shall set its target to the created Target (Proton) object.] link.setTarget(t); // Codes_SRS_AMQPSIOTHUBCONNECTION_14_045: [If the link is the Sender link, the event handler shall set the SenderSettleMode to UNSETTLED.] link.setSenderSettleMode(SenderSettleMode.UNSETTLED); } else { // Codes_SRS_AMQPSIOTHUBCONNECTION_14_046: [If the link is the Receiver link, the event handler shall create a new Source (Proton) object using the receiver endpoint address member variable.] Source source = new Source(); source.setAddress(this.receiveEndpoint); // Codes_SRS_AMQPSIOTHUBCONNECTION_14_047: [If the link is the Receiver link, the event handler shall set its source to the created Source (Proton) object.] link.setSource(source); } }
private Source createNonSharedSource(TerminusDurability terminusDurability) { Source source = new Source(); source.setAddress(address.toString()); source.setCapabilities(TOPIC_CAPABILITY); source.setDurable(terminusDurability); return source; }
private Source createSharedSource(TerminusDurability terminusDurability) { Source source = new Source(); source.setAddress(address.toString()); source.setCapabilities(TOPIC_CAPABILITY, SHARED); source.setDurable(terminusDurability); return source; }
private Source createSharedGlobalSource(TerminusDurability terminusDurability) { Source source = new Source(); source.setAddress(address.toString()); source.setCapabilities(TOPIC_CAPABILITY, SHARED, GLOBAL); source.setDurable(terminusDurability); return source; } }
public RequestResponseChannel( final String linkName, final String path, final Session session) { this.replyTo = path.replace("$", "") + "-client-reply-to"; this.openRefCount = new AtomicInteger(2); this.closeRefCount = new AtomicInteger(2); this.inflightRequests = new HashMap<>(); this.requestId = new AtomicLong(0); this.sendLink = session.sender(linkName + ":sender"); final Target target = new Target(); target.setAddress(path); this.sendLink.setTarget(target); sendLink.setSource(new Source()); this.sendLink.setSenderSettleMode(SenderSettleMode.SETTLED); BaseHandler.setHandler(this.sendLink, new SendLinkHandler(new RequestHandler())); this.receiveLink = session.receiver(linkName + ":receiver"); final Source source = new Source(); source.setAddress(path); this.receiveLink.setSource(source); final Target receiverTarget = new Target(); receiverTarget.setAddress(this.replyTo); this.receiveLink.setTarget(receiverTarget); this.receiveLink.setSenderSettleMode(SenderSettleMode.SETTLED); this.receiveLink.setReceiverSettleMode(ReceiverSettleMode.SECOND); BaseHandler.setHandler(this.receiveLink, new ReceiveLinkHandler(new ResponseHandler())); }
public Receiver create(Session session) { Receiver receiver = session.receiver(_path); Source source = new Source(); source.setAddress(_path); receiver.setSource(source); // the C implemenation does this: Target target = new Target(); target.setAddress(_path); receiver.setTarget(target); if (getIncomingWindow() > 0) { // use explicit settlement via dispositions (not pre-settled) receiver.setSenderSettleMode(SenderSettleMode.UNSETTLED); // desired receiver.setReceiverSettleMode(ReceiverSettleMode.SECOND); } return receiver; } }
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(); } }
public Sender create(Session session) { Sender sender = session.sender(_path); Target target = new Target(); target.setAddress(_path); sender.setTarget(target); // the C implemenation does this: Source source = new Source(); source.setAddress(_path); sender.setSource(source); if (getOutgoingWindow() > 0) { // use explicit settlement via dispositions (not pre-settled) sender.setSenderSettleMode(SenderSettleMode.UNSETTLED); sender.setReceiverSettleMode(ReceiverSettleMode.SECOND); // desired } return sender; } }
public Sender create(Session session) { Sender sender = session.sender(_path); Target target = new Target(); target.setAddress(_path); sender.setTarget(target); // the C implemenation does this: Source source = new Source(); source.setAddress(_path); sender.setSource(source); if (getOutgoingWindow() > 0) { // use explicit settlement via dispositions (not pre-settled) sender.setSenderSettleMode(SenderSettleMode.UNSETTLED); sender.setReceiverSettleMode(ReceiverSettleMode.SECOND); // desired } return sender; } }
public Receiver create(Session session) { Receiver receiver = session.receiver(_path); Source source = new Source(); source.setAddress(_path); receiver.setSource(source); // the C implemenation does this: Target target = new Target(); target.setAddress(_path); receiver.setTarget(target); if (getIncomingWindow() > 0) { // use explicit settlement via dispositions (not pre-settled) receiver.setSenderSettleMode(SenderSettleMode.UNSETTLED); // desired receiver.setReceiverSettleMode(ReceiverSettleMode.SECOND); } return receiver; } }
@Override public AMQPClientReceiverContext createReceiver(String name, String address) throws ActiveMQAMQPException { FutureRunnable futureRunnable = new FutureRunnable(1); ProtonClientReceiverContext amqpReceiver; synchronized (connection.getLock()) { Receiver receiver = session.receiver(name); Source source = new Source(); source.setAddress(address); receiver.setSource(source); amqpReceiver = new ProtonClientReceiverContext(sessionSPI, connection, this, receiver); receiver.setContext(amqpReceiver); amqpReceiver.afterInit(futureRunnable); receiver.open(); } connection.flush(); waitWithTimeout(futureRunnable); return amqpReceiver; } }
source.setAddress(getQueueName()); source.setFilter(filters); source.setDurable(TerminusDurability.NONE);
source.setAddress(getQueueName()); source.setFilter(filters); source.setDurable(TerminusDurability.NONE);
@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(); }
@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(); }
@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(); } }