Package org.apache.camel

Examples of org.apache.camel.AsyncCallback


        } catch (Throwable t) {
            exchange.setException(t);
            callback.done(true);
            return true;
        }
        return processor.process(exchange, new AsyncCallback() {
            public void done(boolean doneSynchronously) {
                try {
                    after.process(exchange);
                    callback.done(doneSynchronously);
                } catch (Throwable t) {
View Full Code Here


        loadBalancer.process(exchange);
    }

    public boolean process(Exchange exchange, final AsyncCallback callback) {
        ObjectHelper.notNull(loadBalancer, "loadBalancer");
        return AsyncProcessorHelper.process(loadBalancer, exchange, new AsyncCallback() {
            public void done(boolean doneSync) {
                // only handle the async case
                if (doneSync) {
                    return;
                } else {
View Full Code Here

    @Override
    protected boolean processNext(final Exchange exchange, final AsyncCallback callback) {
        inflightRepository.add(exchange, id);
       
        boolean sync = processor.process(exchange, new AsyncCallback() {
            public void done(boolean doneSync) {
                try {
                    inflightRepository.remove(exchange, id);
                } finally {
                    callback.done(doneSync);
View Full Code Here

    protected boolean processAsync(final Exchange exchange, final AsyncCallback callback, final UnitOfWork uow) {
        LOG.trace("Processing exchange asynchronously: {}", exchange);

        // process the exchange asynchronously
        try {
            return processor.process(exchange, new AsyncCallback() {
                public void done(boolean doneSync) {
                    // Order here matters. We need to complete the callbacks
                    // since they will likely update the exchange with some final results.
                    try {
                        callback.done(doneSync);
View Full Code Here

    @Override
    public boolean process(final Exchange exchange, final AsyncCallback callback) {
        // only record time if stats is enabled
        final StopWatch watch = (counter != null && counter.isStatisticsEnabled()) ? new StopWatch() : null;

        return super.process(exchange, new AsyncCallback() {
            public void done(boolean doneSync) {
                try {
                    // record end time
                    if (watch != null) {
                        recordTime(exchange, watch.stop());
View Full Code Here

        final StopWatch watch = exchange != null ? new StopWatch() : null;

        try {
            // 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) {
                            long timeTaken = watch.stop();
View Full Code Here

            }

            // 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();

                    // we only have to handle async completion of the routing slip
View Full Code Here

            log.debug("About to process file: {} using exchange: {}", target, exchange);

            // process the exchange using the async consumer to support async routing engine
            // which can be supported by this file consumer as all the done work is
            // provided in the GenericFileOnCompletion
            getAsyncProcessor().process(exchange, new AsyncCallback() {
                public void done(boolean doneSync) {
                    // noop
                    if (log.isTraceEnabled()) {
                        log.trace("Done processing file: {} {}", target, doneSync ? "synchronously" : "asynchronously");
                    }
View Full Code Here

                // emmit event we are doing redelivery
                EventHelper.notifyExchangeRedelivery(exchange.getContext(), exchange, data.redeliveryCounter);
            }

            // process the exchange (also redelivery)
            boolean sync = AsyncProcessorHelper.process(outputAsync, exchange, new AsyncCallback() {
                public void done(boolean sync) {
                    // this callback should only handle the async case
                    if (sync) {
                        return;
                    }
View Full Code Here

            // 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);
                        // fire event as we had a failure processor to handle it, which there is a event for
View Full Code Here

TOP

Related Classes of org.apache.camel.AsyncCallback

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.