org.mule.routing
Class MessageFilter

java.lang.Object
  extended by org.mule.processor.AbstractInterceptingMessageProcessorBase
      extended by org.mule.processor.AbstractInterceptingMessageProcessor
          extended by org.mule.processor.AbstractFilteringMessageProcessor
              extended by org.mule.routing.MessageFilter
All Implemented Interfaces:
AnnotatedObject, FlowConstructAware, MuleContextAware, Disposable, Initialisable, Lifecycle, Startable, Stoppable, InterceptingMessageProcessor, MessageProcessor, MessageSource
Direct Known Subclasses:
ForwardingConsumer

public class MessageFilter
extends AbstractFilteringMessageProcessor
implements FlowConstructAware, Lifecycle

Implementation of InterceptingMessageProcessor that filters message flow using a Filter. Is the filter accepts the message then message flow continues to the next message processor. If the filter does not accept the message processor and a message processor is configured for handling unaccepted message then this will be invoked, otherwise null will be returned.

EIP Reference: http://www.eaipatterns .com/Filter.html


Field Summary
protected  Filter filter
           
 
Fields inherited from class org.mule.processor.AbstractFilteringMessageProcessor
onUnacceptedFlowConstruct, throwOnUnaccepted, unacceptedMessageProcessor
 
Fields inherited from class org.mule.processor.AbstractInterceptingMessageProcessorBase
logger, muleContext, next, notificationHandler
 
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
 
Fields inherited from interface org.mule.api.AnnotatedObject
PROPERTY_NAME
 
Constructor Summary
MessageFilter()
          Deprecated. Use MessageFilter(Filter filter)
MessageFilter(Filter filter)
           
MessageFilter(Filter filter, boolean throwExceptionOnUnaccepted, MessageProcessor messageProcessor)
           
 
Method Summary
protected  boolean accept(MuleEvent event)
           
 void dispose()
          A lifecycle method where implementor should free up any resources.
protected  MuleException filterUnacceptedException(MuleEvent event)
           
 Filter getFilter()
           
 void initialise()
          Method used to perform any initialisation work.
 void setFilter(Filter filter)
           
 void setFlowConstruct(FlowConstruct flowConstruct)
           
 void setMuleContext(MuleContext context)
           
 void start()
           
 void stop()
           
 String toString()
           
 
Methods inherited from class org.mule.processor.AbstractFilteringMessageProcessor
getUnacceptedMessageProcessor, handleUnaccepted, isThrowOnUnaccepted, process, setThrowOnUnaccepted, setUnacceptedMessageProcessor
 
Methods inherited from class org.mule.processor.AbstractInterceptingMessageProcessorBase
getAnnotation, getAnnotations, getListener, getMuleContext, isEventValid, processNext, setAnnotations, setListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mule.api.source.MessageSource
setListener
 

Field Detail

filter

protected Filter filter
Constructor Detail

MessageFilter

@Deprecated
public MessageFilter()
Deprecated. Use MessageFilter(Filter filter)

For IoC only


MessageFilter

public MessageFilter(Filter filter)

MessageFilter

public MessageFilter(Filter filter,
                     boolean throwExceptionOnUnaccepted,
                     MessageProcessor messageProcessor)
Parameters:
filter -
throwExceptionOnUnaccepted - throw a FilterUnacceptedException when a message is rejected by the filter?
messageProcessor - used to handler unaccepted messages
Method Detail

accept

protected boolean accept(MuleEvent event)
Specified by:
accept in class AbstractFilteringMessageProcessor

filterUnacceptedException

protected MuleException filterUnacceptedException(MuleEvent event)
Overrides:
filterUnacceptedException in class AbstractFilteringMessageProcessor

getFilter

public Filter getFilter()

setFilter

public void setFilter(Filter filter)

toString

public String toString()
Overrides:
toString in class AbstractInterceptingMessageProcessorBase

setMuleContext

public void setMuleContext(MuleContext context)
Specified by:
setMuleContext in interface MuleContextAware
Overrides:
setMuleContext in class AbstractInterceptingMessageProcessorBase

setFlowConstruct

public void setFlowConstruct(FlowConstruct flowConstruct)
Specified by:
setFlowConstruct in interface FlowConstructAware

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
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
Throws:
MuleException

stop

public void stop()
          throws MuleException
Specified by:
stop in interface Stoppable
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


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