public Void run() throws Exception { service.getProviderHandler().handleMessage(exchange); return null; } };
public Void run() throws Exception { service.getProviderHandler().handleMessage(exchange); return null; } };
@Override public void process(Exchange ex) throws Exception { org.switchyard.Exchange exchange = new CamelExchange(ex); for (ExchangeHandler handler : _handlers) { if (exchange.getState() == ExchangeState.FAULT) { handler.handleFault(exchange); } else { handler.handleMessage(exchange); } } }
@Override public void process(Exchange ex) throws Exception { org.switchyard.Exchange exchange = new CamelExchange(ex); for (ExchangeHandler handler : _handlers) { if (exchange.getState() == ExchangeState.FAULT) { handler.handleFault(exchange); } else { handler.handleMessage(exchange); } } }
@Override public void handleMessage(Exchange exchange) { HandlerRef handlerRef = null; try { for (HandlerRef ref : listHandlers()) { handlerRef = ref; if (_logger.isDebugEnabled()) { _logger.debug("Executing ExchangeHandler (" + ref + ") on message Exchange instance (" + System.identityHashCode(exchange) + ")."); } ref.getHandler().handleMessage(exchange); if (exchange.getState() == ExchangeState.FAULT) { // Exchange state has changed to FAULT. // Stop executing handlers.... break; } } } catch (HandlerException handlerEx) { StringBuilder errorMsg = new StringBuilder(handlerEx.getClass().getName() + " was thrown by handler(" + handlerRef.getName() + "): " + handlerEx.getMessage()); Throwable cause = handlerEx; while ((cause = cause.getCause()) != null) { errorMsg.append(" --- Caused by " + cause.getClass().getName() + ": " + cause.getMessage()); } _logger.error(errorMsg.toString()); _logger.debug("", handlerEx); Message faultMessage = exchange.createMessage().setContent(handlerEx); exchange.sendFault(faultMessage); } }
@Override public void handleMessage(Exchange exchange) { HandlerRef handlerRef = null; try { for (HandlerRef ref : listHandlers()) { handlerRef = ref; if (_logger.isDebugEnabled()) { _logger.debug("Executing ExchangeHandler (" + ref + ") on message Exchange instance (" + System.identityHashCode(exchange) + ")."); } ref.getHandler().handleMessage(exchange); if (exchange.getState() == ExchangeState.FAULT) { // Exchange state has changed to FAULT. // Stop executing handlers.... break; } } } catch (HandlerException handlerEx) { StringBuilder errorMsg = new StringBuilder(handlerEx.getClass().getName() + " was thrown by handler(" + handlerRef.getName() + "): " + handlerEx.getMessage()); Throwable cause = handlerEx; while ((cause = cause.getCause()) != null) { errorMsg.append(" --- Caused by " + cause.getClass().getName() + ": " + cause.getMessage()); } _logger.error(errorMsg.toString()); _logger.debug("", handlerEx); Message faultMessage = exchange.createMessage().setContent(handlerEx); exchange.sendFault(faultMessage); } }
service.getProviderHandler().handleMessage(exchange);
service.getProviderHandler().handleMessage(exchange);
@Override public void process(Exchange ex) throws Exception { org.switchyard.Exchange syEx = new CamelExchange(ex); if (syEx.getState() == ExchangeState.FAULT) { ExchangeHandler handler = syEx.getReplyHandler(); if (handler != null) { handler.handleFault(syEx); } } else { // Only call back with reply messages if the MEP is In-Out if (ExchangePattern.IN_OUT.equals(syEx.getPattern())) { syEx.getReplyHandler().handleMessage(syEx); } } } }
@Override public void process(Exchange ex) throws Exception { org.switchyard.Exchange syEx = new CamelExchange(ex); if (syEx.getState() == ExchangeState.FAULT) { ExchangeHandler handler = syEx.getReplyHandler(); if (handler != null) { handler.handleFault(syEx); } } else { // Only call back with reply messages if the MEP is In-Out if (ExchangePattern.IN_OUT.equals(syEx.getPattern())) { syEx.getReplyHandler().handleMessage(syEx); } } } }