Examples of AsyncProcessor


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 = AsyncProcessorConverterHelper.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

Examples of org.apache.camel.AsyncProcessor

            // store the last to endpoint as the failure endpoint
            exchange.setProperty(Exchange.FAILURE_ENDPOINT, exchange.getProperty(Exchange.TO_ENDPOINT));

            // the failure processor could also be asynchronous
            AsyncProcessor afp = AsyncProcessorConverterHelper.convert(processor);
            sync = AsyncProcessorHelper.process(afp, exchange, new AsyncCallback() {
                public void done(boolean sync) {
                    log.trace("Failure processor done: {} processing Exchange: {}", processor, exchange);
                    try {
                        prepareExchangeAfterFailure(exchange, data, shouldHandle, shouldContinue);
View Full Code Here

Examples of org.apache.camel.AsyncProcessor

     * @param exchange input data.
     */
    public boolean process(final Exchange exchange, final AsyncCallback callback) {
        final Exchange resourceExchange = createResourceExchange(exchange, ExchangePattern.InOut);

        AsyncProcessor ap = AsyncProcessorConverterHelper.convert(producer);
        boolean sync = AsyncProcessorHelper.process(ap, 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

Examples of org.apache.camel.AsyncProcessor

                        exchange.setIn(exchange.getOut());
                        exchange.setOut(null);
                    }

                    // route to original destination leveraging the asynchronous routing engine
                    AsyncProcessor async = AsyncProcessorConverterHelper.convert(producer);
                    return AsyncProcessorHelper.process(async, exchange, callback);
                } else {
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("Stop() means skip sending exchange to original intended destination: {} for exchange: {}", getEndpoint(), exchange);
                    }
View Full Code Here

Examples of org.apache.camel.AsyncProcessor

            // indicate its done synchronously
            exchange.setException(new CamelExchangeException("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

Examples of org.apache.camel.AsyncProcessor

    public void beforeWrap(RouteContext routeContext, ProcessorDefinition<?> definition) { 
        //Not implemented
    }
   
    public Processor wrap(RouteContext routeContext, final Processor processor) {       
        return new AsyncProcessor() {
            public boolean process(Exchange exchange, final AsyncCallback callback)  {
                boolean sync;
                try {
                    applySecurityPolicy(exchange);
                } catch (Exception e) {
                    // exception occurred so break out
                    exchange.setException(e);
                    callback.done(true);
                    return true;
                }
               
                // If here, then user is authenticated and authorized
                // Now let the original processor continue routing supporting the async routing engine
                AsyncProcessor ap = AsyncProcessorConverterHelper.convert(processor);
                sync = AsyncProcessorHelper.process(ap, 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

Examples of org.apache.camel.AsyncProcessor

            exchange.setException(e);
            callback.done(true);
            return true;
        }

        AsyncProcessor target = rlp;
        if (isShareUnitOfWork()) {
            // wrap answer in a sub unit of work, since we share the unit of work
            target = new SubUnitOfWorkProcessor(rlp);
        }
View Full Code Here

Examples of org.apache.camel.AsyncProcessor

        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

Examples of org.apache.camel.AsyncProcessor

            if (producer != null) {
                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 = AsyncProcessorHelper.process(async, exchange, new AsyncCallback() {
                public void done(boolean doneSync) {
                    // we are done with the exchange pair
                    pair.done();
View Full Code Here

Examples of org.apache.camel.AsyncProcessor

            if (producer != null) {
                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();
            // we invoke it synchronously as parallel async routing is too hard
            AsyncProcessorHelper.process(async, exchange);
        } finally {
            pair.done();
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.