Package org.apache.camel

Examples of org.apache.camel.AsyncProcessor


                traced.pushBlock();
            }

            // let the prepared process it, remember to begin the exchange pair
            // we invoke it synchronously as parallel async routing is too hard
            AsyncProcessor async = AsyncProcessorTypeConverter.convert(processor);
            pair.begin();
            AsyncProcessorHelper.process(async, exchange);
        } finally {
            pair.done();
            // pop the block so by next round we have the same staring point and thus the tracing looks accurate
View Full Code Here


        while (continueRouting(processors, exchange)) {
            ExchangeHelper.prepareOutToIn(exchange);

            // process the next processor
            AsyncProcessor processor = processors.next();
            boolean sync = process(exchange, callback, processor, processors);

            // continue as long its being processed synchronously
            if (!sync) {
                LOG.trace("Processing exchangeId: {} is continued being processed asynchronously", exchange.getExchangeId());
View Full Code Here

                // continue processing the try .. catch .. finally asynchronously
                while (continueRouting(processors, exchange)) {
                    ExchangeHelper.prepareOutToIn(exchange);

                    // process the next processor
                    AsyncProcessor processor = processors.next();
                    doneSync = process(exchange, callback, processor, processors);

                    if (!doneSync) {
                        LOG.trace("Processing exchangeId: {} is continued being processed asynchronously", exchange.getExchangeId());
                        // the remainder of the try .. catch .. finally will be completed async
View Full Code Here

        // behavior as the original thread is not blocking while we wait for the reply
        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 (!list.isEmpty()) {
            Processor processor = chooseProcessor(list, exchange);
            if (processor == null) {
                throw new IllegalStateException("No processors could be chosen to process " + exchange);
            } else {
                AsyncProcessor albp = AsyncProcessorTypeConverter.convert(processor);
                boolean sync = AsyncProcessorHelper.process(albp, exchange, new AsyncCallback() {
                    public void done(boolean doneSync) {
                        // only handle the async case
                        if (doneSync) {
                            return;
View Full Code Here

        if (processor == null) {
            throw new IllegalStateException("No processors could be chosen to process " + exchange);
        }
        log.debug("Processing failover at attempt {} for {}", attempts, exchange);

        AsyncProcessor albp = AsyncProcessorTypeConverter.convert(processor);
        return AsyncProcessorHelper.process(albp, exchange, new FailOverAsyncCallback(exchange, attempts, index, callback, processors));
    }
View Full Code Here

            // indicate its done synchronously
            exchange.setException(new DirectConsumerNotAvailableException("No consumers available on endpoint: " + endpoint, exchange));
            callback.done(true);
            return true;
        } else {
            AsyncProcessor processor = AsyncProcessorConverterHelper.convert(endpoint.getConsumer().getProcessor());
            return AsyncProcessorHelper.process(processor, exchange, callback);
        }
    }
View Full Code Here

            LOG.warn("No consumers available on endpoint: " + endpoint + " to process: " + exchange);
            exchange.setException(new CamelExchangeException("No consumers available on endpoint: " + endpoint, exchange));
            callback.done(true);
            return true;
        } else {
            AsyncProcessor processor = AsyncProcessorConverterHelper.convert(consumer.getProcessor());
            return AsyncProcessorHelper.process(processor, exchange, callback);
        }
    }
View Full Code Here

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

        try {
            if (exchange != null) {
                EventHelper.notifyExchangeSending(exchange.getContext(), exchange, endpoint);
            }
            // invoke the callback
            AsyncProcessor asyncProcessor = AsyncProcessorConverterHelper.convert(producer);
            sync = producerCallback.doInAsyncProducer(producer, asyncProcessor, exchange, pattern, new AsyncCallback() {
                @Override
                public void done(boolean doneSync) {
                    try {
                        if (watch != null) {
View Full Code Here

TOP

Related Classes of org.apache.camel.AsyncProcessor

Copyright © 2018 www.massapicom. 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.