org.apache.camel.processor
Class MulticastProcessor

java.lang.Object
  extended by org.apache.camel.impl.ServiceSupport
      extended by org.apache.camel.processor.MulticastProcessor
All Implemented Interfaces:
Processor, Service
Direct Known Subclasses:
Pipeline, Splitter

public class MulticastProcessor
extends ServiceSupport
implements Processor

Implements the Multicast pattern to send a message exchange to a number of endpoints, each endpoint receiving a copy of the message exchange.

Version:
$Revision: 2038 $
See Also:
Pipeline

Constructor Summary
MulticastProcessor(Collection<Processor> processors)
           
MulticastProcessor(Collection<Processor> processors, AggregationStrategy aggregationStrategy)
           
MulticastProcessor(Collection<Processor> processors, AggregationStrategy aggregationStrategy, boolean parallelProcessing, ThreadPoolExecutor executor)
           
MulticastProcessor(Collection<Processor> processors, AggregationStrategy aggregationStrategy, boolean parallelProcessing, ThreadPoolExecutor executor, boolean streaming)
           
 
Method Summary
protected  Iterable<org.apache.camel.processor.MulticastProcessor.ProcessorExchangePair> createProcessorExchangePairs(Exchange exchange)
           
protected  void doAggregate(AtomicExchange result, Exchange exchange)
          Aggregate the Exchange with the current result
protected  void doStart()
           
protected  void doStop()
           
 AggregationStrategy getAggregationStrategy()
           
 Collection<Processor> getProcessors()
          Returns the producers to multicast to
protected  boolean isStreaming()
          Is the multicast processor working in streaming mode? In streaming mode: we use Iterable to ensure we can send messages as soon as the data becomes available for parallel processing, we start aggregating responses as they get send back to the processor; this means the AggregationStrategy has to take care of handling out-of-order arrival of exchanges
 void process(Exchange exchange)
          Processes the message exchange
static
<E extends Exchange>
Collection<Processor>
toProducers(Collection<Endpoint> endpoints)
          A helper method to convert a list of endpoints into a list of processors
 String toString()
           
protected  void updateNewExchange(Exchange exchange, int i, Iterable<org.apache.camel.processor.MulticastProcessor.ProcessorExchangePair> allPairs)
           
 
Methods inherited from class org.apache.camel.impl.ServiceSupport
addChildService, getThreadName, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, nextThreadCounter, removeChildService, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MulticastProcessor

public MulticastProcessor(Collection<Processor> processors)

MulticastProcessor

public MulticastProcessor(Collection<Processor> processors,
                          AggregationStrategy aggregationStrategy)

MulticastProcessor

public MulticastProcessor(Collection<Processor> processors,
                          AggregationStrategy aggregationStrategy,
                          boolean parallelProcessing,
                          ThreadPoolExecutor executor)

MulticastProcessor

public MulticastProcessor(Collection<Processor> processors,
                          AggregationStrategy aggregationStrategy,
                          boolean parallelProcessing,
                          ThreadPoolExecutor executor,
                          boolean streaming)
Method Detail

toProducers

public static <E extends Exchange> Collection<Processor> toProducers(Collection<Endpoint> endpoints)
                                         throws Exception
A helper method to convert a list of endpoints into a list of processors

Throws:
Exception

toString

public String toString()
Overrides:
toString in class Object

process

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

Specified by:
process in interface Processor
Throws:
Exception - if an internal processing error has occurred.

doAggregate

protected void doAggregate(AtomicExchange result,
                           Exchange exchange)
Aggregate the Exchange with the current result

Parameters:
result - the current result
exchange - the exchange to be added to the result

updateNewExchange

protected void updateNewExchange(Exchange exchange,
                                 int i,
                                 Iterable<org.apache.camel.processor.MulticastProcessor.ProcessorExchangePair> allPairs)

createProcessorExchangePairs

protected Iterable<org.apache.camel.processor.MulticastProcessor.ProcessorExchangePair> createProcessorExchangePairs(Exchange exchange)

doStop

protected void doStop()
               throws Exception
Specified by:
doStop in class ServiceSupport
Throws:
Exception

doStart

protected void doStart()
                throws Exception
Specified by:
doStart in class ServiceSupport
Throws:
Exception

isStreaming

protected boolean isStreaming()
Is the multicast processor working in streaming mode? In streaming mode:


getProcessors

public Collection<Processor> getProcessors()
Returns the producers to multicast to


getAggregationStrategy

public AggregationStrategy getAggregationStrategy()


Copyright © 2010 IONA Open Source Community. All Rights Reserved.