use of org.apache.qpid.proton.engine.Link in project azure-iot-sdk-java by Azure.
the class ReceiverLinkHandler method onLinkInit.
@Override
public void onLinkInit(Event event) {
// This function is called per sender/receiver link after it is instantiated, and before it is opened.
// It sets some properties on that link, and then opens it.
Link link = event.getLink();
Source source = new Source();
source.setAddress(this.receiverLinkAddress);
link.setSource(source);
link.setReceiverSettleMode(ReceiverSettleMode.FIRST);
link.setProperties(this.amqpProperties);
link.open();
log.trace("Opening {} receiver link with correlation id {}", this.getLinkInstanceType(), this.linkCorrelationId);
}
use of org.apache.qpid.proton.engine.Link in project azure-iot-sdk-java by Azure.
the class ReceiverLinkHandler method onLinkLocalClose.
@Override
public void onLinkLocalClose(Event event) {
Link link = event.getLink();
if (link.getRemoteState() == EndpointState.CLOSED) {
log.trace("Closing amqp session now that this {} receiver link with link correlation id {} has closed remotely and locally", getLinkInstanceType(), linkCorrelationId);
event.getSession().close();
} else {
log.trace("{} receiver link with correlation id {} was closed locally", this.getLinkInstanceType(), this.linkCorrelationId);
}
}
use of org.apache.qpid.proton.engine.Link in project azure-iot-sdk-java by Azure.
the class AmqpsSenderLinkHandler method onLinkRemoteClose.
@Override
public void onLinkRemoteClose(Event event) {
Link link = event.getLink();
if (link.getLocalState() == EndpointState.ACTIVE) {
log.debug("{} sender link with address {} and link correlation id {} was closed remotely unexpectedly", getLinkInstanceType(), this.senderLinkAddress, this.linkCorrelationId);
link.close();
this.amqpsLinkStateCallback.onLinkClosedUnexpectedly(link.getRemoteCondition());
} else {
log.trace("Closing amqp session now that its {} sender link with address {} and link correlation id {} has closed remotely and locally", getLinkInstanceType(), this.senderLinkAddress, linkCorrelationId);
event.getSession().close();
}
}
use of org.apache.qpid.proton.engine.Link in project azure-iot-sdk-java by Azure.
the class AmqpsSenderLinkHandler method onLinkLocalClose.
@Override
public void onLinkLocalClose(Event event) {
Link link = event.getLink();
if (link.getRemoteState() == EndpointState.CLOSED) {
log.trace("Closing amqp session now that its {} sender link with address {} and link correlation id {} has closed remotely and locally", getLinkInstanceType(), this.senderLinkAddress, linkCorrelationId);
event.getSession().close();
} else {
log.trace("{} sender link with address {} and link correlation id {} was closed locally", this.getLinkInstanceType(), this.senderLinkAddress, this.linkCorrelationId);
}
}
use of org.apache.qpid.proton.engine.Link in project azure-iot-sdk-java by Azure.
the class AmqpsSenderLinkHandler method onLinkInit.
@Override
public void onLinkInit(Event event) {
// This function is called per sender/receiver link after it is instantiated, and before it is opened.
// It sets some properties on that link, and then opens it.
Link link = event.getLink();
Target target = new Target();
target.setAddress(this.senderLinkAddress);
link.setTarget(target);
link.setSenderSettleMode(SenderSettleMode.UNSETTLED);
link.setProperties(this.amqpProperties);
link.open();
log.trace("Opening {} sender link with address {} and link correlation id {}", this.getLinkInstanceType(), this.senderLinkAddress, this.linkCorrelationId);
}
Aggregations