Search in sources :

Example 6 with Link

use of org.apache.qpid.proton.engine.Link in project azure-iot-sdk-java by Azure.

the class ReceiverLinkHandler method onLinkRemoteClose.

@Override
public void onLinkRemoteClose(Event event) {
    Link link = event.getLink();
    if (link.getLocalState() == EndpointState.ACTIVE) {
        log.debug("{} receiver link with link correlation id {} was closed remotely unexpectedly", getLinkInstanceType(), this.linkCorrelationId);
        link.close();
    } else {
        log.trace("Closing amqp session now that this {} receiver link with link correlation id {} has closed remotely and locally", getLinkInstanceType(), linkCorrelationId);
        event.getSession().close();
    }
}
Also used : Link(org.apache.qpid.proton.engine.Link)

Example 7 with Link

use of org.apache.qpid.proton.engine.Link in project azure-iot-sdk-java by Azure.

the class SenderLinkHandler 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 correlation id {}", this.getLinkInstanceType(), this.linkCorrelationId);
}
Also used : Target(org.apache.qpid.proton.amqp.messaging.Target) Link(org.apache.qpid.proton.engine.Link)

Example 8 with Link

use of org.apache.qpid.proton.engine.Link in project azure-iot-sdk-java by Azure.

the class SenderLinkHandler 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 {} sender link with link correlation id {} has closed remotely and locally", getLinkInstanceType(), linkCorrelationId);
        event.getSession().close();
    } else {
        log.trace("{} sender link with correlation id {} was closed locally", this.getLinkInstanceType(), this.linkCorrelationId);
    }
}
Also used : Link(org.apache.qpid.proton.engine.Link)

Example 9 with Link

use of org.apache.qpid.proton.engine.Link in project azure-iot-sdk-java by Azure.

the class SenderLinkHandler method onLinkRemoteClose.

@Override
public void onLinkRemoteClose(Event event) {
    Link link = event.getLink();
    if (link.getLocalState() == EndpointState.ACTIVE) {
        log.debug("{} sender link with link correlation id {} was closed remotely unexpectedly", getLinkInstanceType(), this.linkCorrelationId);
        link.close();
    } else {
        log.trace("Closing amqp session now that this {} sender link with link correlation id {} has closed remotely and locally", getLinkInstanceType(), linkCorrelationId);
        event.getSession().close();
    }
}
Also used : Link(org.apache.qpid.proton.engine.Link)

Example 10 with Link

use of org.apache.qpid.proton.engine.Link in project azure-service-bus-java by Azure.

the class SendLinkHandler method onLinkRemoteOpen.

@Override
public void onLinkRemoteOpen(Event event) {
    Link link = event.getLink();
    if (link != null && link instanceof Sender) {
        Sender sender = (Sender) link;
        if (link.getRemoteTarget() != null) {
            TRACE_LOGGER.debug("onLinkRemoteOpen: linkName:{}, remoteTarge:{}", sender.getName(), link.getRemoteTarget());
            synchronized (this.firstFlow) {
                this.isFirstFlow = false;
                this.msgSender.onOpenComplete(null);
            }
        } else {
            TRACE_LOGGER.debug("onLinkRemoteOpen: linkName:{}, remoteTarget:{}, remoteSource:{}, action:{}", sender.getName(), null, null, "waitingForError");
        }
    }
}
Also used : Sender(org.apache.qpid.proton.engine.Sender) 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