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

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: 563607 $
See Also:
Pipeline

Constructor Summary
MulticastProcessor(Collection<Processor> processors)
           
 
Method Summary
protected  Exchange copyExchangeStrategy(Processor processor, Exchange exchange)
          Strategy method to copy the exchange before sending to another endpoint.
protected  void doStart()
           
protected  void doStop()
           
 Collection<Processor> getProcessors()
          Returns the producers to multicast to
 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()
           
 
Methods inherited from class org.apache.camel.impl.ServiceSupport
addChildService, getThreadName, isStarted, 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)
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.

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

getProcessors

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


copyExchangeStrategy

protected Exchange copyExchangeStrategy(Processor processor,
                                        Exchange exchange)
Strategy method to copy the exchange before sending to another endpoint. Derived classes such as the Pipeline will not clone the exchange

Parameters:
processor - the processor that will send the exchange
exchange -
Returns:
the current exchange if no copying is required such as for a pipeline otherwise a new copy of the exchange is returned.


Copyright © 2007 Apache Software Foundation. All Rights Reserved.