Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mule.routing.outbound
Class AbstractRoundRobinMessageSplitter

    java.lang.Object
      org.mule.routing.outbound.AbstractOutboundRouter
          org.mule.routing.outbound.FilteringOutboundRouter
              org.mule.routing.outbound.AbstractMessageSplitter
                  org.mule.routing.outbound.AbstractRoundRobinMessageSplitter

All Implemented Interfaces:
  FlowConstructAware, MuleContextAware, Disposable, Initialisable, Lifecycle, Startable, Stoppable, MessageProcessor, MessageRouter, Matchable, MatchableMessageProcessor, MatchableMessageRouter, OutboundRouter, RouterStatisticsRecorder, TransformingMatchable

Direct Known Subclasses:
  ExpressionMessageSplitter, ListMessageSplitter, XmlMessageSplitter

    public class AbstractRoundRobinMessageSplitter

extends AbstractMessageSplitter

`FilteringListMessageSplitter` accepts a List as a message payload then routes list elements as messages over an endpoint where the endpoint's filter accepts the payload.

Field Summary

Fields inherited from class org.mule.routing.outbound.FilteringOutboundRouter
`expressionManager`

Fields inherited from class org.mule.routing.outbound.AbstractOutboundRouter
`enableCorrelation, flowConstruct, initialised, logger, magicProperties, muleContext, replyTo, resultsHandler, routes, started, transactionConfig`

Fields inherited from interface org.mule.api.lifecycle.Initialisable
`PHASE_NAME`

Fields inherited from interface org.mule.api.lifecycle.Startable
`PHASE_NAME`

Fields inherited from interface org.mule.api.lifecycle.Stoppable
`PHASE_NAME`

Fields inherited from interface org.mule.api.lifecycle.Disposable
`PHASE_NAME`

Constructor Summary
`AbstractRoundRobinMessageSplitter()`

Method Summary
`protected SplitMessage` | `getMessageParts(MuleMessage message, List<MessageProcessor> endpoints)` Retrieves a specific message part for the given endpoint.
`void` | `initialise()` Method used to perform any initialisation work.
`boolean` | `isDeterministic()` If this option is true (the default) then the first message part is routed to the first endpoint, the second part to the second endpoint, etc, with the nth part going to the (n modulo number of targets) endpoint.
`boolean` | `isDisableRoundRobin()` The default behaviour for splitter routers is to round-robin across targets.
`boolean` | `isFailIfNoMatch()` If none of the targets match a split message part i.e.
`void` | `setDeterministic(boolean deterministic)` If this option is true (the default) then the first message part is routed to the first endpoint, the second part to the second endpoint, etc, with the nth part going to the (n modulo number of targets) endpoint.
`void` | `setDisableRoundRobin(boolean disableRoundRobin)` The default behaviour for splitter routers is to round-robin across targets.
`void` | `setFailIfNoMatch(boolean failIfNoMatch)` If none of the targets match a split message part i.e.
`protected List` | `splitMessage(MuleMessage message)` Method used just to split the message into parts.

Methods inherited from class org.mule.routing.outbound.AbstractMessageSplitter
`route`

Methods inherited from class org.mule.routing.outbound.FilteringOutboundRouter
`addRoute, getFilter, getRoute, getTransformers, isMatch, isTransformBeforeMatch, isUseTemplates, setFilter, setTransformers, setUseTemplates`

Methods inherited from class org.mule.routing.outbound.AbstractOutboundRouter
`dispose, getEnableCorrelation, getMuleContext, getReplyTo, getResultsHandler, getRoute, getRouterStatistics, getRoutes, getTransactionConfig, isDynamicRoutes, process, propagateMagicProperties, removeRoute, sendRequest, sendRequestEvent, setEnableCorrelation, setEnableCorrelationAsString, setFlowConstruct, setMessageProcessors, setMessageProperties, setMuleContext, setReplyTo, setResultsHandler, setRouterStatistics, setRoutes, setTransactionConfig, start, stop`

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.processor.MessageRouter
`addRoute, removeRoute`

Methods inherited from interface org.mule.api.processor.MessageProcessor
`process`

Constructor Detail

### AbstractRoundRobinMessageSplitter

    public AbstractRoundRobinMessageSplitter()

Method Detail

### 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 `FilteringOutboundRouter`
  Throws:
    `InitialisationException` - if a fatal error occurs causing the Mule instance to shutdown
    `RecoverableException` - if an error occurs that can be recovered from

### splitMessage

    protected List splitMessage(MuleMessage message)

  Method used just to split the message into parts. Each part should be an entry in the list. The list can contain either `MuleMessage` objects or just payloads (Mule will automatically convert the payloads into messages).

  This method can be overridden by custom implementations of splitter router where the distribution of the message parts will be done using either round robin or endpoint filtering.

  Parameters:
    `message` - the source message to split into parts
  Returns:
    a list of payload objects or `MuleMessage` objects. Usually, it is sufficient just to return payload objects

### getMessageParts

    protected SplitMessage getMessageParts(MuleMessage message,
                                           List<MessageProcessor> endpoints)

  Retrieves a specific message part for the given endpoint. the message will then be routed via the provider.

  NOTE:Implementations must provide proper synchronization for shared state (payload, properties, etc.)

  Specified by:
    `getMessageParts` in class `AbstractMessageSplitter`
  Parameters:
    `message` - the current message being processed
    `endpoints` - A list of targets that will be used to dispatch each of the parts
  Returns:
    a `List` of message parts. Each part will become the payload of the outgoing message. Note that the parts will be dispatched to
  See Also:
    `SplitMessage`, `AbstractRoundRobinMessageSplitter`

### isDeterministic

    public boolean isDeterministic()

  If this option is true (the default) then the first message part is routed to the first endpoint, the second part to the second endpoint, etc, with the nth part going to the (n modulo number of targets) endpoint. If false then the messages will be distributed equally amongst all targets.

  The behaviour changes if the targets have filters since the message part will get routed based on the next endpoint that follows the above rule AND passes the endpoint filter.

  Returns:
    true if deterministic has been set to true

### setDeterministic

    public void setDeterministic(boolean deterministic)

  If this option is true (the default) then the first message part is routed to the first endpoint, the second part to the second endpoint, etc, with the nth part going to the (n modulo number of targets) endpoint. If false then the messages will be distributed equally amongst all targets.

  The behaviour changes if the targets have filters since the message part will get routed based on the next endpoint that follows the above rule AND passes the endpoint filter.

  Parameters:
    `deterministic` - the value to set

### isDisableRoundRobin

    public boolean isDisableRoundRobin()

  The default behaviour for splitter routers is to round-robin across targets. When using filters on targets it is sometimes desirable to use only the filters to control which endpoint the split message part goes too. For example, if you have 3 targets where two have a filter but the last does not, you'll need to disable round robin since the 3rd endpoint may end up routing a message that one of the other targets should have routed. Generally it is good practice to either configure all targets with filters or none, in this case there is not need to set this property.

  Returns:
    true if disabled

### setDisableRoundRobin

    public void setDisableRoundRobin(boolean disableRoundRobin)

  The default behaviour for splitter routers is to round-robin across targets. When using filters on targets it is sometimes desirable to use only the filters to control which endpoint the split message part goes too. For example, if you have 3 targets where two have a filter but the last does not, you'll need to disable round robin since the 3rd endpoint may end up routing a message that one of the other targets should have routed. Generally it is good practice to either configure all targets with filters or none, in this case there is not need to set this property.

  Parameters:
    `disableRoundRobin` - true if disabled

### isFailIfNoMatch

    public boolean isFailIfNoMatch()

  If none of the targets match a split message part i.e. each endpoint has a filter for a certain message part. This flag controls whether the part is ignorred or an exceptin is thrown.

  Returns:
    true if an exception should be thrown when no match is found

### setFailIfNoMatch

    public void setFailIfNoMatch(boolean failIfNoMatch)

  If none of the targets match a split message part i.e. each endpoint has a filter for a certain message part. This flag controls whether the part is ignorred or an exceptin is thrown.

  Parameters:
    `failIfNoMatch` - true if an exception should be thrown when no match is found

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2010 MuleSoft, Inc.. All Rights Reserved.