Package org.springframework.amqp.core

Examples of org.springframework.amqp.core.Address


            } catch(Throwable t) {
                exchange.setException(t);
            }
           
            //Send a reply if one was requested
            Address replyToAddress = amqpMessage.getMessageProperties().getReplyToAddress();
            if(replyToAddress != null) {
                org.apache.camel.Message outMessage = exchange.getOut();
                SpringAMQPMessage replyMessage = new SpringAMQPMessage(outMessage);
                exchange.setOut(replyMessage); //Swap out the outbound message
               
                endpoint.getAmqpTemplate().send(replyToAddress.getExchangeName(), replyToAddress.getRoutingKey(), replyMessage.toAMQPMessage(msgConverter));
            }
        }
View Full Code Here


            } catch(Throwable t) {
                exchange.setException(t);
            }
           
            //Send a reply if one was requested
            Address replyToAddress = amqpMessage.getMessageProperties().getReplyToAddress();
            if(replyToAddress != null) {
                org.apache.camel.Message outMessage = exchange.getOut();
                SpringAMQPMessage replyMessage = new SpringAMQPMessage(outMessage);
                exchange.setOut(replyMessage); //Swap out the outbound message

                try {
                    endpoint.getAmqpTemplate().send(replyToAddress.getExchangeName(), replyToAddress.getRoutingKey(), replyMessage.toAMQPMessage(msgConverter));
                } catch(AmqpConnectException e) {
                    LOG.error("AMQP Connection error, marking this connection as failed");
                    onClose(null);
                }
            }
View Full Code Here

            } catch(Throwable t) {
                exchange.setException(t);
            }
           
            //Send a reply if one was requested
            Address replyToAddress = amqpMessage.getMessageProperties().getReplyToAddress();
            if(replyToAddress != null) {
                org.apache.camel.Message outMessage = exchange.getOut();
                SpringAMQPMessage replyMessage = new SpringAMQPMessage(outMessage);
                exchange.setOut(replyMessage); //Swap out the outbound message
               
                endpoint.getAmqpTemplate().send(replyToAddress.getExchangeName(), replyToAddress.getRoutingKey(), replyMessage.toAMQPMessage(msgConverter));
            }
        }
View Full Code Here

            } catch(Throwable t) {
                exchange.setException(t);
            }
           
            //Send a reply if one was requested
            Address replyToAddress = amqpMessage.getMessageProperties().getReplyToAddress();
            if(replyToAddress != null) {
                org.apache.camel.Message outMessage = exchange.getOut();
                SpringAMQPMessage replyMessage = new SpringAMQPMessage(outMessage);

                // Camel exchange will contain a non-null exception if an unhandled exception has occurred,
                // such as when using the DefaultErrorHandler with default configuration, or when
                // using the DeadLetterChannel error handler with an OnException handled=false override.
                // Exchange will not contain an exception (via getException()) if the exception has been handled,
                // such as when using the DeadLetterChannel error handler with default configuration, but
                // the Exchange property EXCEPTION_CAUGHT will contain the handled exception.
                if (exchange.getException() != null) {
                    replyMessage.setHeader(SpringAMQPMessage.IS_EXCEPTION_CAUGHT, true);
                    replyMessage.setBody(exchange.getException());
                } else if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
                    replyMessage.setHeader(SpringAMQPMessage.IS_EXCEPTION_CAUGHT, true);
                    replyMessage.setBody(exchange.getProperty(Exchange.EXCEPTION_CAUGHT));
                }

                exchange.setOut(replyMessage); //Swap out the outbound message

                try {
                    endpoint.getAmqpTemplate().send(replyToAddress.getExchangeName(), replyToAddress.getRoutingKey(), replyMessage.toAMQPMessage(msgConverter));
                } catch(AmqpConnectException e) {
                    LOG.error("AMQP Connection error, marking this connection as failed");
                    onClose(null);
                }
            }
View Full Code Here

            } catch(Throwable t) {
                exchange.setException(t);
            }
           
            //Send a reply if one was requested
            Address replyToAddress = amqpMessage.getMessageProperties().getReplyToAddress();
            if(replyToAddress != null) {
                org.apache.camel.Message outMessage = exchange.getOut();
                SpringAMQPMessage replyMessage = new SpringAMQPMessage(outMessage);
                exchange.setOut(replyMessage); //Swap out the outbound message

                try {
                    endpoint.getAmqpTemplate().send(replyToAddress.getExchangeName(), replyToAddress.getRoutingKey(), replyMessage.toAMQPMessage(msgConverter));
                } catch(AmqpConnectException e) {
                    LOG.error("AMQP Connection error, marking this connection as failed");
                    onClose(null);
                }
            }
View Full Code Here

    return this.receiveAndReply(queueName, callback,
        new ReplyToAddressCallback<S>() {

          @Override
          public Address getReplyToAddress(Message request, S reply) {
            return new Address(null, replyExchange, replyRoutingKey);
          }

        });
  }
View Full Code Here

              throw e;
            }
          }

          if (reply != null) {
            Address replyTo = replyToAddressCallback
                .getReplyToAddress(receiveMessage, reply);

            Message replyMessage = RabbitTemplate.this
                .convertMessageIfNecessary(reply);

            MessageProperties receiveMessageProperties = receiveMessage
                .getMessageProperties();
            MessageProperties replyMessageProperties = replyMessage
                .getMessageProperties();

            Object correlation = RabbitTemplate.this.correlationKey == null ? receiveMessageProperties
                .getCorrelationId() : receiveMessageProperties
                .getHeaders().get(
                    RabbitTemplate.this.correlationKey);

            if (RabbitTemplate.this.correlationKey == null
                || correlation == null) {
              // using standard correlationId property
              if (correlation == null) {
                String messageId = receiveMessageProperties
                    .getMessageId();
                if (messageId != null) {
                  correlation = messageId
                      .getBytes(RabbitTemplate.this.encoding);
                }
              }
              replyMessageProperties
                  .setCorrelationId((byte[]) correlation);
            } else {
              replyMessageProperties.setHeader(
                  RabbitTemplate.this.correlationKey,
                  correlation);
            }

            // 'doSend()' takes care about 'channel.txCommit()'.
            RabbitTemplate.this.doSend(channel,
                replyTo.getExchangeName(),
                replyTo.getRoutingKey(), replyMessage, null);
          } else if (channelLocallyTransacted) {
            channel.txCommit();
          }

          return true;
View Full Code Here

   *             if no {@link Address} can be determined
   * @see org.springframework.amqp.core.Message#getMessageProperties()
   * @see org.springframework.amqp.core.MessageProperties#getReplyTo()
   */
  private Address getReplyToAddress(Message request) throws AmqpException {
    Address replyTo = request.getMessageProperties().getReplyToAddress();
    if (replyTo == null) {
      if (this.exchange == null) {
        throw new AmqpException(
            "Cannot determine ReplyTo message property value: "
                + "Request message does not contain reply-to property, and no default Exchange was set.");
      }
      replyTo = new Address(null, this.exchange, this.routingKey);
    }
    return replyTo;
  }
View Full Code Here

            } catch(Throwable t) {
                exchange.setException(t);
            }
           
            //Send a reply if one was requested
            Address replyToAddress = amqpMessage.getMessageProperties().getReplyToAddress();
            if(replyToAddress != null && endpoint.isAutoReply()) {
                org.apache.camel.Message outMessage = exchange.getOut();
                SpringAMQPMessage replyMessage = new SpringAMQPMessage(outMessage);

                // Camel exchange will contain a non-null exception if an unhandled exception has occurred,
                // such as when using the DefaultErrorHandler with default configuration, or when
                // using the DeadLetterChannel error handler with an OnException handled=false override.
                // Exchange will not contain an exception (via getException()) if the exception has been handled,
                // such as when using the DeadLetterChannel error handler with default configuration, but
                // the Exchange property EXCEPTION_CAUGHT will contain the handled exception.
                if (exchange.getException() != null) {
                    replyMessage.setHeader(SpringAMQPMessage.IS_EXCEPTION_CAUGHT, true);
                    replyMessage.setBody(exchange.getException());
                } else if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
                    replyMessage.setHeader(SpringAMQPMessage.IS_EXCEPTION_CAUGHT, true);
                    replyMessage.setBody(exchange.getProperty(Exchange.EXCEPTION_CAUGHT));
                }

                exchange.setOut(replyMessage); //Swap out the outbound message

                try {
                    endpoint.getAmqpTemplate().send(replyToAddress.getExchangeName(), replyToAddress.getRoutingKey(), replyMessage.toAMQPMessage(msgConverter));
                } catch(AmqpConnectException e) {
                    LOG.error("AMQP Connection error, marking this connection as failed");
                    onClose(null);
                }
            }
View Full Code Here

            } catch(Throwable t) {
                exchange.setException(t);
            }
           
            //Send a reply if one was requested
            Address replyToAddress = amqpMessage.getMessageProperties().getReplyToAddress();
            if(replyToAddress != null) {
                org.apache.camel.Message outMessage = exchange.getOut();
                SpringAMQPMessage replyMessage = new SpringAMQPMessage(outMessage);
                exchange.setOut(replyMessage); //Swap out the outbound message

                try {
                    endpoint.getAmqpTemplate().send(replyToAddress.getExchangeName(), replyToAddress.getRoutingKey(), replyMessage.toAMQPMessage(msgConverter));
                } catch(AmqpConnectException e) {
                    LOG.error("AMQP Connection error, marking this connection as failed");
                    onClose(null);
                }
            }
View Full Code Here

TOP

Related Classes of org.springframework.amqp.core.Address

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.