@Override public String getName() { return link.getName(); }
public void processOnClose(Link link, Exception exception) { if (TRACE_LOGGER.isInfoEnabled()) { TRACE_LOGGER.info(String.format("processOnClose linkName[%s], exception[%s]", link.getName(), exception != null ? exception.getMessage() : "n/a")); } this.underlyingEntity.onError(exception); }
/** * Event handler for the link remote open event. This signifies that the * {@link org.apache.qpid.proton.reactor.Reactor} is ready, so we set the connection to OPEN. * @param event The Proton Event object. */ @Override public void onLinkRemoteOpen(Event event) { // Codes_SRS_AMQPSIOTHUBCONNECTION_15_041: [The connection state shall be considered OPEN when the sender link is open remotely.] Link link = event.getLink(); if (link.getName().equals(sendTag)) { this.state = State.OPEN; } }
@Override public void onLinkLocalClose(Event event) { Link link = event.getLink(); if (link != null) { TRACE_LOGGER.debug("local link close. linkName:{}", link.getName()); } closeSession(link); }
public void processOnClose(Link link, ErrorCondition condition) { if (TRACE_LOGGER.isInfoEnabled()) { TRACE_LOGGER.info(String.format("processOnClose linkName[%s], errorCondition[%s], errorDescription[%s]", link.getName(), condition != null ? condition.getCondition() : "n/a", condition != null ? condition.getDescription() : "n/a")); } this.underlyingEntity.onClose(condition); }
/** * Event handler for the link remote close event. This triggers reconnection attempts until successful. * Both sender and receiver links closing trigger this event, so we only handle one of them, * since the other is redundant. * @param event The Proton Event object. */ @Override public void onLinkRemoteClose(Event event) { this.state = State.CLOSED; // Codes_SRS_AMQPSIOTHUBCONNECTION_15_042 [The event handler shall attempt to startReconnect to the IoTHub.] if (event.getLink().getName().equals(sendTag)) { // Codes_SRS_AMQPSIOTHUBCONNECTION_15_048: [The event handler shall attempt to startReconnect to IoTHub.] startReconnect(); } }
public void processOnClose(Link link, ErrorCondition condition) { if (condition != null) { TRACE_LOGGER.debug("linkName:{}, ErrorCondition:{}, {}", link.getName(), condition.getCondition(), condition.getDescription()); } this.underlyingEntity.onClose(condition); }
@Override public void onLinkRemoteDetach(Event event) { final Link link = event.getLink(); final ErrorCondition condition = link.getCondition(); if (TRACE_LOGGER.isInfoEnabled()) { TRACE_LOGGER.info(String.format("onLinkRemoteDetach linkName[%s], errorCondition[%s], errorDescription[%s]", link.getName(), condition != null ? condition.getCondition() : "n/a", condition != null ? condition.getDescription() : "n/a")); } handleRemoteLinkClosed(event); }
@Override public void onLinkRemoteClose(Event event) { final Link link = event.getLink(); final ErrorCondition condition = link.getRemoteCondition(); if (TRACE_LOGGER.isInfoEnabled()) { TRACE_LOGGER.info(String.format("onLinkRemoteClose linkName[%s], errorCondition[%s], errorDescription[%s]", link.getName(), condition != null ? condition.getCondition() : "n/a", condition != null ? condition.getDescription() : "n/a")); } handleRemoteLinkClosed(event); }
@Override public void onLinkLocalClose(Event event) { final Link link = event.getLink(); final ErrorCondition condition = link.getCondition(); if (TRACE_LOGGER.isInfoEnabled()) { TRACE_LOGGER.info(String.format("onLinkLocalClose linkName[%s], errorCondition[%s], errorDescription[%s]", link.getName(), condition != null ? condition.getCondition() : "n/a", condition != null ? condition.getDescription() : "n/a")); } closeSession(link, link.getCondition()); }
private void closeSession(Link link, ErrorCondition condition) { final Session session = link.getSession(); if (session != null && session.getLocalState() != EndpointState.CLOSED) { if (TRACE_LOGGER.isInfoEnabled()) { TRACE_LOGGER.info(String.format("closeSession for linkName[%s], errorCondition[%s], errorDescription[%s]", link.getName(), condition != null ? condition.getCondition() : "n/a", condition != null ? condition.getDescription() : "n/a")); } session.setCondition(condition); session.close(); } }
@Override public void onLinkRemoteDetach(Event event) { final Link link = event.getLink(); if(link != null) { TRACE_LOGGER.debug("link remote detach. linkName:{}", link.getName()); if (link.getLocalState() != EndpointState.CLOSED) { link.close(); } this.processOnClose(link, link.getRemoteCondition()); closeSession(link); } }
@Override public void onLinkRemoteClose(Event event) { final Link link = event.getLink(); if(link != null) { TRACE_LOGGER.debug("link remote close. linkName:{}", link.getName()); if (link.getLocalState() != EndpointState.CLOSED) { link.close(); } ErrorCondition condition = link.getRemoteCondition(); this.processOnClose(link, condition); closeSession(link); } }
/** * Event handler for the link remote open event. This signifies that the * {@link org.apache.qpid.proton.reactor.Reactor} is ready, so we set the connection to OPEN. * @param event The Proton Event object. */ @Override public void onLinkRemoteOpen(Event event) { logger.LogDebug("Entered in method %s", logger.getMethodName()); String linkName = event.getLink().getName(); if (amqpDeviceOperations.isReceiverLinkTag(linkName)) { this.isOpen = true; if (msgListener != null) { msgListener.connectionEstablished(); openLatch.countDown(); } } logger.LogDebug("Exited from method %s", logger.getMethodName()); }
@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); } }
receiver.advance(); EngineConnection.SubscriptionData subData = engineConnection.subscriptionData.get(event.getLink().getName()); subData.unsettled++; QOS qos = delivery.remotelySettled() ? QOS.AT_MOST_ONCE : QOS.AT_LEAST_ONCE; subData.subscriber.tell(new DeliveryRequest(data, qos, event.getLink().getName(), delivery, event.getConnection()), this);
/** * Event handler for the delivery event. This method handles both sending and receiving a message. * @param event The Proton Event object. */ @Override public void onDelivery(Event event) { logger.LogDebug("Entered in method %s", logger.getMethodName()); AmqpMessage message = amqpDeviceOperations.receiverMessageFromLink(event.getLink().getName()); if (message == null) { //Sender specific section for dispositions it receives if (event.getType() == Event.Type.DELIVERY) { // Codes_SRS_AMQPSIOTHUBCONNECTION_15_038: [If this link is the Sender link and the event type is DELIVERY, the event handler shall get the Delivery (Proton) object from the event.] Delivery d = event.getDelivery(); DeliveryState remoteState = d.getRemoteState(); // Codes_SRS_AMQPSIOTHUBCONNECTION_15_039: [The event handler shall note the remote delivery state and use it and the Delivery (Proton) hash code to inform the AmqpsIotHubConnection of the message receipt.] boolean state = remoteState.equals(Accepted.getInstance()); //let any listener know that the message was received by the server // release the delivery object which created in sendMessage(). d.free(); } } else { msgListener.messageReceived(message); } logger.LogDebug("Exited from method %s", logger.getMethodName()); }
if (delivery.isReadable() && !delivery.isPartial() && delivery.getLink().getName().equals(RECEIVE_TAG))