org.mule.routing
Class ScatterGatherRouter
java.lang.Object
org.mule.processor.AbstractMuleObjectOwner<MessageProcessor>
org.mule.processor.AbstractMessageProcessorOwner
org.mule.routing.ScatterGatherRouter
- All Implemented Interfaces:
- AnnotatedObject, FlowConstructAware, MuleContextAware, Disposable, Initialisable, Lifecycle, Startable, Stoppable, MessageProcessor, MessageProcessorContainer, MessageRouter
public class ScatterGatherRouter
- extends AbstractMessageProcessorOwner
- implements MessageRouter
The Scatter-Gather router will broadcast copies of the current
message to every endpoint registered with the router in parallel.
It is very similar to the <all> implemented in the
MulticastingRouter class, except that this router processes in parallel
instead of sequentially.
Differences with MulticastingRouter router:
For advanced use cases, a custom AggregationStrategy can be applied to
customize the logic used to aggregate the route responses back into one single
element or to throw exception
EIP Reference:
- Since:
- 3.5.0
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.mule.api.lifecycle.Stoppable |
stop |
ScatterGatherRouter
public ScatterGatherRouter()
process
public MuleEvent process(MuleEvent event)
throws MuleException
- Description copied from interface:
MessageProcessor
- Invokes the MessageProcessor.
- Specified by:
process in interface MessageProcessor
- Parameters:
event - MuleEvent to be processed
- Returns:
- optional response MuleEvent
- Throws:
MuleException
initialise
public void initialise()
throws InitialisationException
- Description copied from interface:
Initialisable
- Method used to perform any initialisation work. If a fatal error occurs during
initialisation an
InitialisationException should be thrown,
causing the Mule instance to shutdown. If the error is recoverable, say by
retrying to connect, a RecoverableException should be thrown.
There is no guarantee that by throwing a Recoverable exception that the Mule
instance will not shut down.
- Specified by:
initialise in interface Initialisable- Overrides:
initialise in class AbstractMuleObjectOwner<MessageProcessor>
- Throws:
InitialisationException - if a fatal error occurs causing the Mule instance to shutdown
RecoverableException - if an error occurs that can be recovered from
start
public void start()
throws MuleException
- Specified by:
start in interface Startable- Overrides:
start in class AbstractMuleObjectOwner<MessageProcessor>
- Throws:
MuleException
dispose
public void dispose()
- Description copied from interface:
Disposable
- A lifecycle method where implementor should free up any resources. If an
exception is thrown it should just be logged and processing should continue.
This method should not throw Runtime exceptions.
- Specified by:
dispose in interface Disposable- Overrides:
dispose in class AbstractMuleObjectOwner<MessageProcessor>
addRoute
public void addRoute(MessageProcessor processor)
throws MuleException
- Adds a new message processor to the list of routes
- Specified by:
addRoute in interface MessageRouter
- Parameters:
processor - new destination message processor
- Throws:
IllegalStateException - if invoked after initialise() is
completed
MuleException
removeRoute
public void removeRoute(MessageProcessor processor)
throws MuleException
- Removes a message processor from the list of routes
- Specified by:
removeRoute in interface MessageRouter
- Parameters:
processor - destination message processor to remove
- Throws:
IllegalStateException - if invoked after initialise() is
completed
MuleException
getOwnedMessageProcessors
protected List<MessageProcessor> getOwnedMessageProcessors()
- Specified by:
getOwnedMessageProcessors in class AbstractMessageProcessorOwner
setAggregationStrategy
public void setAggregationStrategy(AggregationStrategy aggregationStrategy)
setThreadingProfile
public void setThreadingProfile(ThreadingProfile threadingProfile)
setTimeout
public void setTimeout(long timeout)
setRoutes
public void setRoutes(List<MessageProcessor> routes)
Copyright © 2003–2014 MuleSoft, Inc.. All rights reserved.