Package org.apache.camel

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


                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


                Exception e = new IllegalStateException("No processors could be chosen to process " + exchange);
                exchange.setException(e);
            } 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

            internalProcessor.addAdvice(new CamelInternalProcessor.SubUnitOfWorkProcessorAdvice());
            target = internalProcessor;
        }

        // now let the multicast process the exchange
        return target.process(exchange, callback);
    }

    protected Endpoint resolveEndpoint(Exchange exchange, Object recipient) {
        // trim strings as end users might have added spaces between separators
        if (recipient instanceof String) {
View Full Code Here

        if (processor == null) {
            throw new IllegalStateException("No processors could be chosen to process CircuitBreaker");
        }

        AsyncProcessor albp = AsyncProcessorConverterHelper.convert(processor);
        boolean sync = albp.process(exchange, callback);

        boolean failed = hasFailed(exchange);

        if (!failed) {
            failures.set(0);
View Full Code Here

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

        AsyncProcessor albp = AsyncProcessorConverterHelper.convert(processor);
        return albp.process(copy, new FailOverAsyncCallback(exchange, copy, attempts, index, callback, processors));
    }

    /**
     * Failover logic to be executed asynchronously if one of the failover endpoints
     * is a real {@link AsyncProcessor}.
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

                    }

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

                continue;
            }

            // okay we found a filter or its the otherwise we are processing
            AsyncProcessor async = AsyncProcessorConverterHelper.convert(processor);
            return async.process(exchange, choiceCallback);
        }

        // when no filter matches and there is no otherwise, then just continue
        choiceCallback.done(true);
        return true;
View Full Code Here

            }

            if (!data.currentRedeliveryPolicy.shouldRedeliver(data.redeliveryCounter)) {
                setFailureHandled(exchange, true);
                AsyncProcessor afp = AsyncProcessorTypeConverter.convert(data.failureProcessor);
                boolean sync = afp.process(exchange, new AsyncCallback() {
                    public void done(boolean sync) {
                        restoreExceptionOnExchange(exchange);
                        callback.done(data.sync);
                    }
                });
View Full Code Here

                exchange.setProperty(Exchange.FAILURE_ROUTE_ID, uow.getRouteContext().getRoute().getId());
            }

            // the failure processor could also be asynchronous
            AsyncProcessor afp = AsyncProcessorConverterHelper.convert(processor);
            sync = afp.process(exchange, new AsyncCallback() {
                public void done(boolean sync) {
                    log.trace("Failure processor done: {} processing Exchange: {}", processor, exchange);
                    try {
                        prepareExchangeAfterFailure(exchange, data, shouldHandle, shouldContinue);
                        // fire event as we had a failure processor to handle it, which there is a event for
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.