Package org.apache.camel

Examples of org.apache.camel.AsyncProcessor.process()


        if (exchange.getUnitOfWork() != null) {
            exchange.getUnitOfWork().pushRouteContext(routeContext);
        }

        AsyncProcessor async = AsyncProcessorTypeConverter.convert(processor);
        boolean sync = async.process(exchange, new AsyncCallback() {
            public void done(boolean doneSync) {
                // pop the route context we just used
                if (exchange.getUnitOfWork() != null) {
                    exchange.getUnitOfWork().popRouteContext();
                }
View Full Code Here


        if (LOG.isTraceEnabled()) {
            LOG.trace("RedeliveryProcessor " + redeliveryProcessor + " is processing Exchange: " + exchange + " before its redelivered");
        }

        AsyncProcessor afp = AsyncProcessorTypeConverter.convert(redeliveryProcessor);
        afp.process(exchange, new AsyncCallback() {
            public void done(boolean sync) {
                LOG.trace("Redelivery processor done");
                // do NOT call done on callback as this is the redelivery processor that
                // is done. we should not mark the entire exchange as done.
            }
View Full Code Here

       
        // reset cached streams so they can be read again
        MessageHelper.resetStreamCache(exchange.getIn());

        AsyncProcessor afp = AsyncProcessorTypeConverter.convert(data.failureProcessor);
        boolean sync = afp.process(exchange, new AsyncCallback() {
            public void done(boolean sync) {
                restoreExceptionOnExchange(exchange, data.handledPredicate);
                callback.done(data.sync);
            }
        });
View Full Code Here

        if (size == 0) {
            LOG.warn("No consumers available on endpoint: " + endpoint + " to process " + exchange);
        } else if (size == 1) {
            DefaultConsumer consumer = endpoint.getConsumers().get(0);
            AsyncProcessor processor = AsyncProcessorTypeConverter.convert(consumer.getProcessor());
            return processor.process(exchange, callback);
        } else if (size > 1) {
            // Too hard to do multiple async.. do it sync
            try {
                for (DefaultConsumer consumer : endpoint.getConsumers()) {
                    consumer.getProcessor().process(exchange);
View Full Code Here

        if (LOG.isTraceEnabled()) {
            LOG.trace("RedeliveryProcessor " + data.onRedeliveryProcessor + " is processing Exchange: " + exchange + " before its redelivered");
        }

        AsyncProcessor afp = AsyncProcessorTypeConverter.convert(data.onRedeliveryProcessor);
        afp.process(exchange, new AsyncCallback() {
            public void done(boolean sync) {
                LOG.trace("Redelivery processor done");
                // do NOT call done on callback as this is the redelivery processor that
                // is done. we should not mark the entire exchange as done.
            }
View Full Code Here

        // must decrement the redelivery counter as we didn't process the redelivery but is
        // handling by the failure handler. So we must -1 to not let the counter be out-of-sync
        decrementRedeliveryCounter(exchange);

        AsyncProcessor afp = AsyncProcessorTypeConverter.convert(data.failureProcessor);
        boolean sync = afp.process(exchange, new AsyncCallback() {
            public void done(boolean sync) {
                LOG.trace("Fault processor done");
                restoreExceptionOnExchange(exchange, data.handledPredicate);
                callback.done(data.sync);
            }
View Full Code Here

        if (processor == null) {
            throw new IllegalStateException("No processors could be chosen to process " + exchange);
        } else {
            if (processor instanceof AsyncProcessor) {
                AsyncProcessor asyncProcessor = (AsyncProcessor)processor;
                sync = asyncProcessor.process(exchange, new AsyncCallback() {
                    public void done(boolean sync) {
                        // Only handle the async case...
                        if (!sync) {
                            callback.done(sync);
                        }
View Full Code Here

        if (processor == null) {
            throw new IllegalStateException("No processors could be chosen to process " + exchange);
        }
        if (processor instanceof AsyncProcessor) {
            AsyncProcessor asyncProcessor = (AsyncProcessor) processor;
            sync = asyncProcessor.process(exchange, new AsyncCallback() {
                public void done(boolean doSync) {
                    // check the exchange and call the FailOverProcessor
                    if (isCheckedException(exchange) && index < getProcessors().size() - 1) {
                        exchange.setException(null);
                        processExchange(index + 1, exchange, callback);
View Full Code Here

                        exchange.setException(error);
                    }
                } else {
                    for (DefaultConsumer<E> consumer : consumers) {
                        AsyncProcessor processor = AsyncProcessorTypeConverter.convert(consumer.getProcessor());
                        return processor.process(exchange, callback);
                    }
                }
            }
            callback.done(true);
            return true;
View Full Code Here

            }

            if (!data.currentRedeliveryPolicy.shouldRedeliver(data.redeliveryCounter)) {
                setFailureHandled(exchange, true);
                AsyncProcessor afp = AsyncProcessorTypeConverter.convert(data.failureProcessor);
                return afp.process(exchange, new AsyncCallback() {
                    public void done(boolean sync) {
                        callback.done(data.sync);
                    }
                });
            }
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.