Search in sources :

Example 1 with Coordinator

use of org.apache.qpid.proton.amqp.transaction.Coordinator in project activemq-artemis by apache.

the class AmqpTransactionCoordinator method doOpen.

@Override
protected void doOpen() {
    Coordinator coordinator = new Coordinator();
    coordinator.setCapabilities(TxnCapability.LOCAL_TXN);
    Source source = new Source();
    String coordinatorName = "qpid-jms:coordinator:" + session.getConnection().getConnectionId();
    Sender sender = session.getEndpoint().sender(coordinatorName);
    sender.setSource(source);
    sender.setTarget(coordinator);
    sender.setSenderSettleMode(SenderSettleMode.UNSETTLED);
    sender.setReceiverSettleMode(ReceiverSettleMode.FIRST);
    setEndpoint(sender);
    super.doOpen();
}
Also used : Sender(org.apache.qpid.proton.engine.Sender) Coordinator(org.apache.qpid.proton.amqp.transaction.Coordinator) Source(org.apache.qpid.proton.amqp.messaging.Source)

Example 2 with Coordinator

use of org.apache.qpid.proton.amqp.transaction.Coordinator in project activemq-artemis by apache.

the class AMQPConnectionContext method remoteLinkOpened.

protected void remoteLinkOpened(Link link) throws Exception {
    AMQPSessionContext protonSession = getSessionExtension(link.getSession());
    link.setSource(link.getRemoteSource());
    link.setTarget(link.getRemoteTarget());
    if (link instanceof Receiver) {
        Receiver receiver = (Receiver) link;
        if (link.getRemoteTarget() instanceof Coordinator) {
            Coordinator coordinator = (Coordinator) link.getRemoteTarget();
            protonSession.addTransactionHandler(coordinator, receiver);
        } else {
            protonSession.addReceiver(receiver);
        }
    } else {
        Sender sender = (Sender) link;
        protonSession.addSender(sender);
    }
}
Also used : Sender(org.apache.qpid.proton.engine.Sender) Receiver(org.apache.qpid.proton.engine.Receiver) Coordinator(org.apache.qpid.proton.amqp.transaction.Coordinator)

Aggregations

Coordinator (org.apache.qpid.proton.amqp.transaction.Coordinator)2 Sender (org.apache.qpid.proton.engine.Sender)2 Source (org.apache.qpid.proton.amqp.messaging.Source)1 Receiver (org.apache.qpid.proton.engine.Receiver)1