@Override public void onLinkFlow(Event event) { if (this.isFirstFlow) { synchronized (this.firstFlow) { if (this.isFirstFlow) { this.msgSender.onOpenComplete(null); this.isFirstFlow = false; } } } Sender sender = event.getSender(); this.msgSender.onFlow(sender.getRemoteCredit()); if (TRACE_LOGGER.isDebugEnabled()) { TRACE_LOGGER.debug("onLinkFlow linkName[" + sender.getName() + "], unsettled[" + sender.getUnsettled() + "], credit[" + sender.getCredit() + "]"); } } }
@Override public void onLinkFlow(Event event) { if (this.isFirstFlow) { synchronized (this.firstFlow) { if (this.isFirstFlow) { this.msgSender.onOpenComplete(null); this.isFirstFlow = false; } } } Sender sender = event.getSender(); this.msgSender.onFlow(sender.getRemoteCredit()); TRACE_LOGGER.debug("onLinkFlow: linkName:{}, unsettled:{}, credit:{}", sender.getName(), sender.getUnsettled(), sender.getCredit()); } }
@Override public void onDelivery(Event event) { //Codes_SRS_SERVICE_SDK_JAVA_AMQPSENDHANDLER_25_023: [ The event handler shall get the Delivery from the event only if the event type is DELIVERY **]** 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(); //Codes_SRS_SERVICE_SDK_JAVA_AMQPSENDHANDLER_25_024: [ The event handler shall get the Delivery remote state from the delivery **]** DeliveryState remoteState = d.getRemoteState(); //Codes_SRS_SERVICE_SDK_JAVA_AMQPSENDHANDLER_25_025: [ The event handler shall verify the Amqp response and add the response to a queue. **]** sendStatusQueue.add(new AmqpResponseVerification(remoteState)); //Codes_SRS_SERVICE_SDK_JAVA_AMQPSENDHANDLER_25_026: [ The event handler shall settle the delivery. **]** d.settle(); //Codes_SRS_SERVICE_SDK_JAVA_AMQPSENDHANDLER_25_027: [ The event handler shall get the Sender (Proton) object from the event **]** Sender snd = event.getSender(); //Codes_SRS_SERVICE_SDK_JAVA_AMQPSENDHANDLER_25_028: [ The event handler shall close the Sender, Session and Connection **]** snd.close(); snd.getSession().close(); snd.getSession().getConnection().close(); isConnected = false; } }
String errorDescription = ""; String senderError = event.getSender() != null && event.getSender().getRemoteCondition() != null && event.getSender().getRemoteCondition().getCondition() != null ? event.getSender().getRemoteCondition().getCondition().toString() : ""; String receiverError = event.getReceiver() != null && event.getReceiver().getRemoteCondition() != null && event.getReceiver().getRemoteCondition().getCondition() != null ? event.getReceiver().getRemoteCondition().getCondition().toString() : ""; String sessionError = event.getSession() != null && event.getSession().getRemoteCondition() != null && event.getSession().getRemoteCondition().getCondition() != null ? event.getSession().getRemoteCondition().getCondition().toString() : ""; String transportError = event.getTransport() != null && event.getTransport().getRemoteCondition() != null && event.getTransport().getRemoteCondition().getCondition() != null ? event.getTransport().getRemoteCondition().getCondition().toString() : ""; String senderErrorDescription = event.getSender() != null && event.getSender().getRemoteCondition() != null && event.getSender().getRemoteCondition().getDescription() != null ? event.getSender().getRemoteCondition().getDescription() : ""; String receiverErrorDescription = event.getReceiver() != null && event.getReceiver().getRemoteCondition() != null && event.getReceiver().getRemoteCondition().getDescription() != null ? event.getReceiver().getRemoteCondition().getDescription() : ""; String sessionErrorDescription = event.getSession() != null && event.getSession().getRemoteCondition() != null && event.getSession().getRemoteCondition().getDescription() != null ? event.getSession().getRemoteCondition().getDescription() : "";