public void setMarshaller(JmsMarshaler marshaler) {
this.marshaler = marshaler;
}
public void onMessage(Message jmsMessage) {
JmsProducer producer = producerPool.borrowProducer();
try {
InOut messageExchange = getDeliveryChannel().createExchangeFactory().createInOutExchange();
NormalizedMessage inMessage = messageExchange.createMessage();
try {
marshaler.toNMS(inMessage, jmsMessage);
messageExchange.setInMessage(inMessage);
if (getDeliveryChannel().sendSync(messageExchange)) {
Session session = producer.getSession();
Destination destination = destinationChooser.chooseDestination(messageExchange);
Message message = marshaler.createMessage(messageExchange.getOutMessage(), session);
producer.getMessageProducer().send(destination, message);
}
}
catch (JMSException e) {
messageExchange.setError(e);
messageExchange.setStatus(ExchangeStatus.ERROR);