Package org.apache.qpid.proton.amqp.messaging

Examples of org.apache.qpid.proton.amqp.messaging.Rejected


      }
      catch (Exception e)
      {
         e.printStackTrace();
         Rejected rejected = new Rejected();
         ErrorCondition condition = new ErrorCondition();
         condition.setCondition(Symbol.valueOf("failed"));
         condition.setDescription(e.getMessage());
         rejected.setError(condition);
         delivery.disposition(rejected);
      }
   }
View Full Code Here


      }
      catch (Exception e)
      {
         e.printStackTrace();
         Rejected rejected = new Rejected();
         ErrorCondition condition = new ErrorCondition();
         condition.setCondition(Symbol.valueOf("failed"));
         condition.setDescription(e.getMessage());
         rejected.setError(condition);
         delivery.disposition(rejected);
      }
   }
View Full Code Here

                if (destination != null) {
                    message.setJMSDestination(destination);
                } else if (isAnonymous()) {
                    Destination toDestination = message.getJMSDestination();
                    if (toDestination == null || !(toDestination instanceof ActiveMQDestination)) {
                        Rejected rejected = new Rejected();
                        ErrorCondition condition = new ErrorCondition();
                        condition.setCondition(Symbol.valueOf("failed"));
                        condition.setDescription("Missing to field for message sent to an anonymous producer");
                        rejected.setError(condition);
                        delivery.disposition(rejected);
                        return;
                    }
                }
                message.setProducerId(producerId);

                // Always override the AMQP client's MessageId with our own.  Preserve
                // the original in the TextView property for later Ack.
                MessageId messageId = new MessageId(producerId, messageIdGenerator.getNextSequenceId());

                MessageId amqpMessageId = message.getMessageId();
                if (amqpMessageId != null) {
                    if (amqpMessageId.getTextView() != null) {
                        messageId.setTextView(amqpMessageId.getTextView());
                    } else {
                        messageId.setTextView(amqpMessageId.toString());
                    }
                }

                message.setMessageId(messageId);

                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());
View Full Code Here

                    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());
View Full Code Here

TOP

Related Classes of org.apache.qpid.proton.amqp.messaging.Rejected

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.