org.apache.camel.processor
Class Pipeline

java.lang.Object
  extended by org.apache.camel.support.ServiceSupport
      extended by org.apache.camel.processor.MulticastProcessor
          extended by org.apache.camel.processor.Pipeline
All Implemented Interfaces:
AsyncProcessor, Navigate<Processor>, Processor, Service, ShutdownableService, StatefulService, SuspendableService, Traceable

public class Pipeline
extends MulticastProcessor
implements AsyncProcessor, Traceable

Creates a Pipeline pattern where the output of the previous step is sent as input to the next step, reusing the same message exchanges

Version:

Field Summary
 
Fields inherited from class org.apache.camel.processor.MulticastProcessor
onPrepare
 
Fields inherited from class org.apache.camel.support.ServiceSupport
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
 
Constructor Summary
Pipeline(CamelContext camelContext, Collection<Processor> processors)
           
 
Method Summary
protected  boolean continueRouting(Iterator<Processor> it, Exchange exchange)
           
protected  Exchange createNextExchange(Exchange previousExchange)
          Strategy method to create the next exchange from the previous exchange.
 String getTraceLabel()
          Gets the trace label used for logging when tracing is enabled.
static Processor newInstance(CamelContext camelContext, List<Processor> processors)
           
 void process(Exchange exchange)
          Processes the message exchange
 boolean process(Exchange exchange, AsyncCallback callback)
          Processes the message exchange.
 String toString()
           
 
Methods inherited from class org.apache.camel.processor.MulticastProcessor
createAggregateExecutorService, createErrorHandler, createProcessorExchangePair, createProcessorExchangePairs, createUnitOfWorkProcessor, doAggregate, doDone, doProcessParallel, doProcessSequential, doShutdown, doStart, doStop, getAggregationStrategy, getAggregationStrategy, getCamelContext, getExchangeIndex, getProcessors, getTimeout, hasNext, isParallelProcessing, isShareUnitOfWork, isStopOnException, isStreaming, next, prepareSharedUnitOfWork, removeAggregationStrategyFromExchange, setAggregationStrategyOnExchange, setToEndpoint, updateNewExchange
 
Methods inherited from class org.apache.camel.support.ServiceSupport
doResume, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, resume, shutdown, start, stop, suspend
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pipeline

public Pipeline(CamelContext camelContext,
                Collection<Processor> processors)
Method Detail

newInstance

public static Processor newInstance(CamelContext camelContext,
                                    List<Processor> processors)

process

public void process(Exchange exchange)
             throws Exception
Description copied from interface: Processor
Processes the message exchange

Specified by:
process in interface Processor
Overrides:
process in class MulticastProcessor
Parameters:
exchange - the message exchange
Throws:
Exception - if an internal processing error has occurred.

process

public boolean process(Exchange exchange,
                       AsyncCallback callback)
Description copied from interface: AsyncProcessor
Processes the message exchange. Similar to Processor.process(org.apache.camel.Exchange), but the caller supports having the exchange asynchronously processed.

If there was a failure processing then the caused Exception would be set on the Exchange.

Specified by:
process in interface AsyncProcessor
Overrides:
process in class MulticastProcessor
Parameters:
exchange - the message exchange
callback - the AsyncCallback will be invoked when the processing of the exchange is completed. If the exchange is completed synchronously, then the callback is also invoked synchronously. The callback should therefore be careful of starting recursive loop.
Returns:
(doneSync) true to continue execute synchronously, false to continue being executed asynchronously
See Also:
AsyncProcessorHelper.process(AsyncProcessor, Exchange, AsyncCallback)

createNextExchange

protected Exchange createNextExchange(Exchange previousExchange)
Strategy method to create the next exchange from the previous exchange.

Remember to copy the original exchange id otherwise correlation of ids in the log is a problem

Parameters:
previousExchange - the previous exchange
Returns:
a new exchange

continueRouting

protected boolean continueRouting(Iterator<Processor> it,
                                  Exchange exchange)

toString

public String toString()
Overrides:
toString in class MulticastProcessor

getTraceLabel

public String getTraceLabel()
Description copied from interface: Traceable
Gets the trace label used for logging when tracing is enabled.

The label should be short and precise.

Specified by:
getTraceLabel in interface Traceable
Overrides:
getTraceLabel in class MulticastProcessor
Returns:
the label


Apache CAMEL