org.mule.source
Class ClusterizableMessageSourceWrapper

java.lang.Object
  extended by org.mule.source.ClusterizableMessageSourceWrapper
All Implemented Interfaces:
FlowConstructAware, MuleContextAware, ClusterNodeNotificationListener, ServerNotificationListener, Disposable, Initialisable, Lifecycle, Startable, Stoppable, MessageSource

public class ClusterizableMessageSourceWrapper
extends Object
implements MessageSource, Lifecycle, ClusterNodeNotificationListener, MuleContextAware, FlowConstructAware

Wraps a ClusterizableMessageSource in order to manage the lifecycle of the wrapped instance differently depending if the node is primary or not inside a cluster. Non clustered nodes are always primary.


Field Summary
protected static Log logger
           
 
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
ClusterizableMessageSourceWrapper(ClusterizableMessageSource messageSource)
           
ClusterizableMessageSourceWrapper(MuleContext muleContext, ClusterizableMessageSource messageSource, FlowConstruct flowConstruct)
           
 
Method Summary
 void dispose()
          A lifecycle method where implementor should free up any resources.
 void initialise()
          Method used to perform any initialisation work.
 boolean isStarted()
           
 void onNotification(ServerNotification notification)
           
protected  void registerNotificationListener()
           
 void setFlowConstruct(FlowConstruct flowConstruct)
           
 void setListener(MessageProcessor listener)
          Set the MessageProcessor listener on a message source which will be invoked when a message is received or generated.
 void setMuleContext(MuleContext context)
           
 void start()
           
 void stop()
           
protected  void unregisterNotificationListener()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final Log logger
Constructor Detail

ClusterizableMessageSourceWrapper

public ClusterizableMessageSourceWrapper(ClusterizableMessageSource messageSource)

ClusterizableMessageSourceWrapper

public ClusterizableMessageSourceWrapper(MuleContext muleContext,
                                         ClusterizableMessageSource messageSource,
                                         FlowConstruct flowConstruct)
Method Detail

setListener

public void setListener(MessageProcessor listener)
Description copied from interface: MessageSource
Set the MessageProcessor listener on a message source which will be invoked when a message is received or generated.

Specified by:
setListener in interface MessageSource

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

onNotification

public void onNotification(ServerNotification notification)
Specified by:
onNotification in interface ServerNotificationListener

registerNotificationListener

protected void registerNotificationListener()

unregisterNotificationListener

protected void unregisterNotificationListener()

setFlowConstruct

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

setMuleContext

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

isStarted

public boolean isStarted()


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