Package org.apache.qpid.proton.amqp.transaction

Examples of org.apache.qpid.proton.amqp.transaction.TransactionalState


            LOG.trace("Inbound Message:{} from Producer:{}", message.getMessageId(), producerId + ":" + messageId.getProducerSequenceId());

            DeliveryState remoteState = delivery.getRemoteState();
            if (remoteState != null && remoteState instanceof TransactionalState) {
                TransactionalState s = (TransactionalState) remoteState;
                long txid = toLong(s.getTxnId());
                message.setTransactionId(new LocalTransactionId(connectionId, txid));
            }

            message.onSend();
            sendToActiveMQ(message, new ResponseHandler() {
View Full Code Here


                ack.setAckType((byte) ackType);
                ack.setDestination(md.getDestination());

                DeliveryState remoteState = delivery.getRemoteState();
                if (remoteState != null && remoteState instanceof TransactionalState) {
                    TransactionalState s = (TransactionalState) remoteState;
                    long txid = toLong(s.getTxnId());
                    LocalTransactionId localTxId = new LocalTransactionId(connectionId, txid);
                    ack.setTransactionId(localTxId);

                    // Store the message sent in this TX we might need to re-send on rollback
                    md.getMessage().setTransactionId(localTxId);
View Full Code Here

        public void onDelivery(Delivery delivery) throws Exception {
            MessageDispatch md = (MessageDispatch) delivery.getContext();
            DeliveryState state = delivery.getRemoteState();

            if (state instanceof TransactionalState) {
                TransactionalState txState = (TransactionalState) state;
                if (txState.getOutcome() instanceof DeliveryState) {

                    LOG.trace("onDelivery: TX delivery state = {}", state);

                    state = (DeliveryState) txState.getOutcome();

                    if (state instanceof Accepted) {
                        if (!delivery.remotelySettled()) {
                            delivery.disposition(new Accepted());
                        }
View Full Code Here

            LOG.trace("Inbound Message:{} from Producer:{}", message.getMessageId(), producerId + ":" + messageId.getProducerSequenceId());

            DeliveryState remoteState = delivery.getRemoteState();
            if (remoteState != null && remoteState instanceof TransactionalState) {
                TransactionalState s = (TransactionalState) remoteState;
                long txid = toLong(s.getTxnId());
                message.setTransactionId(new LocalTransactionId(connectionId, txid));
            }

            // Lets handle the case where the expiration was set, but the timestamp
            // was not set by the client.  Lets assign the timestamp now, and adjust the
View Full Code Here

                ack.setAckType((byte) ackType);
                ack.setDestination(md.getDestination());

                DeliveryState remoteState = delivery.getRemoteState();
                if (remoteState != null && remoteState instanceof TransactionalState) {
                    TransactionalState s = (TransactionalState) remoteState;
                    long txid = toLong(s.getTxnId());
                    LocalTransactionId localTxId = new LocalTransactionId(connectionId, txid);
                    ack.setTransactionId(localTxId);

                    // Store the message sent in this TX we might need to re-send on rollback
                    md.getMessage().setTransactionId(localTxId);
View Full Code Here

        public void onDelivery(Delivery delivery) throws Exception {
            MessageDispatch md = (MessageDispatch) delivery.getContext();
            DeliveryState state = delivery.getRemoteState();

            if (state instanceof TransactionalState) {
                TransactionalState txState = (TransactionalState) state;
                if (txState.getOutcome() instanceof DeliveryState) {

                    LOG.trace("onDelivery: TX delivery state = {}", state);

                    state = (DeliveryState) txState.getOutcome();

                    if (state instanceof Accepted) {
                        if (!delivery.remotelySettled()) {
                            delivery.disposition(new Accepted());
                        }
View Full Code Here

    public TransactionalState newInstance(Object described)
    {
        List l = (List) described;

        TransactionalState o = new TransactionalState();

        if(l.isEmpty())
        {
            throw new DecodeException("The txn-id field cannot be omitted");
        }

        switch(2 - l.size())
        {

            case 0:
                o.setOutcome( (Outcome) l.get( 1 ) );
            case 1:
                o.setTxnId( (Binary) l.get( 0 ) );
        }


        return o;
    }
View Full Code Here

                LOG.trace("Inbound Message:{} from Producer:{}", message.getMessageId(), producerId + ":" + messageId.getProducerSequenceId());

                final DeliveryState remoteState = delivery.getRemoteState();
                if (remoteState != null && remoteState instanceof TransactionalState) {
                    TransactionalState s = (TransactionalState) remoteState;
                    long txid = toLong(s.getTxnId());
                    message.setTransactionId(new LocalTransactionId(connectionId, txid));
                }

                message.onSend();
                if (!delivery.remotelySettled()) {
                    sendToActiveMQ(message, new ResponseHandler() {

                        @Override
                        public void onResponse(IAmqpProtocolConverter converter, Response response) throws IOException {
                            if (response.isException()) {
                                ExceptionResponse er = (ExceptionResponse) response;
                                Rejected rejected = new Rejected();
                                ErrorCondition condition = new ErrorCondition();
                                condition.setCondition(Symbol.valueOf("failed"));
                                condition.setDescription(er.getException().getMessage());
                                rejected.setError(condition);
                                delivery.disposition(rejected);
                            } else {
                                if (receiver.getCredit() <= (prefetch * .2)) {
                                    LOG.trace("Sending more credit ({}) to producer: {}", prefetch - receiver.getCredit(), producerId);
                                    receiver.flow(prefetch - receiver.getCredit());
                                }

                                if (remoteState != null && remoteState instanceof TransactionalState) {
                                    TransactionalState txAccepted = new TransactionalState();
                                    txAccepted.setOutcome(Accepted.getInstance());
                                    txAccepted.setTxnId(((TransactionalState) remoteState).getTxnId());

                                    delivery.disposition(txAccepted);
                                } else {
                                    delivery.disposition(Accepted.getInstance());
                                }
View Full Code Here

                ack.setAckType((byte) ackType);
                ack.setDestination(md.getDestination());

                DeliveryState remoteState = delivery.getRemoteState();
                if (remoteState != null && remoteState instanceof TransactionalState) {
                    TransactionalState s = (TransactionalState) remoteState;
                    long txid = toLong(s.getTxnId());
                    LocalTransactionId localTxId = new LocalTransactionId(connectionId, txid);
                    ack.setTransactionId(localTxId);

                    // Store the message sent in this TX we might need to
                    // re-send on rollback
View Full Code Here

        public void onDelivery(Delivery delivery) throws Exception {
            MessageDispatch md = (MessageDispatch) delivery.getContext();
            DeliveryState state = delivery.getRemoteState();

            if (state instanceof TransactionalState) {
                TransactionalState txState = (TransactionalState) state;
                if (txState.getOutcome() instanceof DeliveryState) {
                    LOG.trace("onDelivery: TX delivery state = {}", state);
                    state = (DeliveryState) txState.getOutcome();
                    if (state instanceof Accepted) {
                        if (!delivery.remotelySettled()) {
                            delivery.disposition(new Accepted());
                        }
                        settle(delivery, MessageAck.DELIVERED_ACK_TYPE);
View Full Code Here

TOP

Related Classes of org.apache.qpid.proton.amqp.transaction.TransactionalState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.