Examples of CamelExchange


Examples of org.switchyard.bus.camel.CamelExchange

        _handlers = handlers;
    }

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

Examples of org.switchyard.bus.camel.CamelExchange

*/
public class ConsumerCallbackProcessor implements Processor {

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

Examples of org.switchyard.bus.camel.CamelExchange

        if (!traceEnabled(exchange)) {
            return;
        }
       
        try {
            CamelExchange syEx = new CamelExchange(exchange);
            if (ExchangeState.FAULT.equals(syEx.getState())) {
                _trace.handleFault(syEx);
            } else {
                _trace.handleMessage(syEx);
            }
        } catch (Exception ex) {
View Full Code Here

Examples of org.switchyard.bus.camel.CamelExchange

    private void fireInterceptors(Exchange ex) throws HandlerException {
        Map<String, ExchangeInterceptor> interceptors =
                ex.getContext().getRegistry().lookupByType(ExchangeInterceptor.class);
       
        if (interceptors != null && interceptors.size() > 0) {
            CamelExchange syEx = new CamelExchange(ex);
            try {
                // Seed these values up front so that interceptors don't mess with them
                boolean callBefore = isBefore(ex);
                boolean callAfter = isAfter(ex);
               
                for (ExchangeInterceptor interceptor : interceptors.values()) {
                    // Is the interceptor targeting this processor?
                    if (!matchesTarget(interceptor)) {
                        continue;
                    }
                   
                    if (callBefore) {
                        interceptor.before(_target, syEx);
                    } else if (callAfter) {
                        try {
                            interceptor.after(_target, syEx);
                        } catch (Exception error) {
                            // If we are already in fault state, don't allow the
                            // interceptor to throw again - this blows up the route
                            if (ExchangeState.FAULT.equals(syEx.getState())) {
                                BusLogger.ROOT_LOGGER.alreadyInFaultState(error);
                            } else {
                                if (error instanceof HandlerException) {
                                    throw (HandlerException)error;
                                } else {
View Full Code Here

Examples of org.switchyard.bus.camel.CamelExchange

     */
    private static final Logger LOG = Logger.getLogger(ErrorHandlingProcessor.class);

    @Override
    public void process(Exchange exchange) throws Exception {
        CamelExchange ex = new CamelExchange(exchange);
        if (ex.getState() != ExchangeState.FAULT) {
            Exception exception = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class);
            notifyListeners(exchange.getContext(), ex, exception);
            Throwable content = detectHandlerException(exception);
            org.switchyard.Property rollbackOnFaultProperty = ex.getContext().getProperty(org.switchyard.Exchange.ROLLBACK_ON_FAULT);
            if (rollbackOnFaultProperty == null || rollbackOnFaultProperty.getValue() == null) {
                ex.getContext().setProperty(org.switchyard.Exchange.ROLLBACK_ON_FAULT, Boolean.TRUE, Scope.EXCHANGE);
            }
            ex.sendFault(ex.createMessage().setContent(content));
            ExchangeHelper.setFailureHandled(exchange);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.