Package org.apache.camel

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


        getProducerExecutorService().submit(new Callable<Exchange>() {
            public Exchange call() throws Exception {
                // convert the async producer which just blocks until the task is complete
                try {
                    AsyncProcessor asyncProducer = exchange.getContext().getTypeConverter().convertTo(AsyncProcessor.class, producer);
                    asyncProducer.process(exchange, callback);
                } catch (Exception e) {
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("Caught exception while processing: " + exchange, e);
                    }
                    // set the exception on the exchange so Camel error handling can deal with it
View Full Code Here


        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 (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

                public boolean process(final Exchange exchange, final AsyncCallback callback) {
                    invoked++;
                    // let the original processor continue routing
                    exchange.getIn().setHeader(name, "was wrapped");
                    AsyncProcessor ap = AsyncProcessorTypeConverter.convert(processor);
                    boolean sync = ap.process(exchange, new AsyncCallback() {
                        public void done(boolean doneSync) {
                            // we only have to handle async completion of this policy
                            if (doneSync) {
                                return;
                            }
View Full Code Here

            if (processor == null) {
                throw new IllegalStateException("No processors could be chosen to process " + exchange);
            } else {
                if (processor instanceof AsyncProcessor) {
                    AsyncProcessor async = (AsyncProcessor) processor;
                    return async.process(exchange, callback);
                } else {
                    try {
                        processor.process(exchange);
                    } catch (Exception e) {
                        exchange.setException(e);
View Full Code Here

                    }

                    // route to original destination leveraging the asynchronous routing engine if possible
                    if (producer instanceof AsyncProcessor) {
                        AsyncProcessor async = (AsyncProcessor) producer;
                        return async.process(exchange, callback);
                    } else {
                        try {
                            producer.process(exchange);
                        } catch (Exception e) {
                            exchange.setException(e);
View Full Code Here

                EventHelper.notifyExchangeSending(exchange.getContext(), exchange, producer.getEndpoint());
            }
            // let the prepared process it, remember to begin the exchange pair
            AsyncProcessor async = AsyncProcessorConverterHelper.convert(processor);
            pair.begin();
            sync = async.process(exchange, new AsyncCallback() {
                public void done(boolean doneSync) {
                    // we are done with the exchange pair
                    pair.done();

                    // okay we are done, so notify the exchange was sent
View Full Code Here

       
        EventHelper.notifyExchangeSending(exchange.getContext(), resourceExchange, destination);
        // record timing for sending the exchange using the producer
        final StopWatch watch = new StopWatch();
        AsyncProcessor ap = AsyncProcessorConverterHelper.convert(producer);
        boolean sync = ap.process(resourceExchange, new AsyncCallback() {
            public void done(boolean doneSync) {
                // we only have to handle async completion of the routing slip
                if (doneSync) {
                    return;
                }
View Full Code Here

                public boolean process(final Exchange exchange, final AsyncCallback callback) {
                    invoked++;
                    // let the original processor continue routing
                    exchange.getIn().setHeader(name, "was wrapped");
                    AsyncProcessor ap = AsyncProcessorConverterHelper.convert(processor);
                    boolean sync = ap.process(exchange, new AsyncCallback() {
                        public void done(boolean doneSync) {
                            // we only have to handle async completion of this policy
                            if (doneSync) {
                                return;
                            }
View Full Code Here

               
                RouteboxDispatcher dispatcher = new RouteboxDispatcher(producer);
                exchange = dispatcher.dispatchAsync(getRouteboxEndpoint(), exchange);     
                if (getRouteboxEndpoint().getConfig().isSendToConsumer()) {
                    AsyncProcessor processor = ((RouteboxDirectEndpoint)getRouteboxEndpoint()).getConsumer().getAsyncProcessor();
                    flag = processor.process(exchange, callback);
                }
            } catch (Exception e) {
                getExceptionHandler().handleException("Error processing exchange", exchange, e);
            }
        }
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.