Search in sources :

Example 1 with Link

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);
}
Also used : Link(org.apache.qpid.proton.engine.Link) Source(org.apache.qpid.proton.amqp.messaging.Source)

Example 2 with Link

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);
    }
}
Also used : Link(org.apache.qpid.proton.engine.Link)

Example 3 with Link

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();
    }
}
Also used : Link(org.apache.qpid.proton.engine.Link)

Example 4 with Link

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);
    }
}
Also used : Link(org.apache.qpid.proton.engine.Link)

Example 5 with Link

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);
}
Also used : Target(org.apache.qpid.proton.amqp.messaging.Target) Link(org.apache.qpid.proton.engine.Link)

Aggregations

Link (org.apache.qpid.proton.engine.Link)13 Target (org.apache.qpid.proton.amqp.messaging.Target)2 Receiver (org.apache.qpid.proton.engine.Receiver)2 Source (org.apache.qpid.proton.amqp.messaging.Source)1 BaseHandler (org.apache.qpid.proton.engine.BaseHandler)1 Connection (org.apache.qpid.proton.engine.Connection)1 Handler (org.apache.qpid.proton.engine.Handler)1 Sender (org.apache.qpid.proton.engine.Sender)1