/* * (non-Javadoc) * * @see org.apache.servicemix.MessageExchangeListener#onMessageExchange(javax.jbi.messaging.MessageExchange) */ public void onMessageExchange(MessageExchange exchange) throws MessagingException { if (exchange.getRole() == Role.PROVIDER) { processRequest(exchange); } else { processResponse(exchange); } }
public void onMessage(MessageExchange messageExchange, NormalizedMessage message) throws MessagingException { if (messageExchange.getRole() == MessageExchange.Role.PROVIDER) { return; } NormalizedMessage in = messageExchange.getMessage("in"); try { NormalizedMessage out = messageExchange.createMessage(); transform(messageExchange, in, out); if (messageExchange instanceof InOut) { messageExchange.setMessage(out, OUT); } else { InOnly outExchange = exchangeFactory.createInOnlyExchange(); outExchange.setInMessage(out); deliveryChannel.sendSync(outExchange); } done(messageExchange); } catch (Exception e) { error(messageExchange, e); } }