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: 534145 $

Constructor Summary
MulticastProcessor(Collection<Endpoint> endpoints)
           
 
Method Summary
protected  Exchange copyExchangeStrategy(Producer producer, Exchange exchange)
          Strategy method to copy the exchange before sending to another endpoint.
protected  void doStart()
           
protected  void doStop()
           
 Collection<Endpoint> getEndpoints()
          Returns the list of endpoints
 Collection<Producer> getProducers()
          Returns the producers to multicast to
 void process(Exchange exchange)
          Processes the message exchange
static
<E extends Exchange>
Collection<Producer>
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
isStarted, isStopped, isStopping, 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<Endpoint> endpoints)
                   throws Exception
Throws:
Exception
Method Detail

toProducers

public static <E extends Exchange> Collection<Producer> 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

getProducers

public Collection<Producer> getProducers()
Returns the producers to multicast to


getEndpoints

public Collection<Endpoint> getEndpoints()
Returns the list of endpoints


copyExchangeStrategy

protected Exchange copyExchangeStrategy(Producer producer,
                                        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:
producer - the producer that will send the exchange
exchange - @return 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.