public class StartableCompositeMessageSource extends Object implements CompositeMessageSource, Lifecycle, FlowConstructAware, MuleContextAware
CompositeMessageSource
that propagates both injection of FlowConstruct
and lifecycle to nested MessageSource
s.
MessageSource
is started in isolation when composite is stopped then messages will be
lost.
Modifier and Type | Field and Description |
---|---|
protected FlowConstruct |
flowConstruct |
protected AtomicBoolean |
initialised |
protected MessageProcessor |
listener |
protected static Log |
log |
protected MuleContext |
muleContext |
protected List<MessageSource> |
sources |
protected AtomicBoolean |
started |
protected AtomicBoolean |
starting |
PHASE_NAME
PHASE_NAME
PHASE_NAME
PHASE_NAME
Constructor and Description |
---|
StartableCompositeMessageSource() |
Modifier and Type | Method and Description |
---|---|
void |
addSource(MessageSource source) |
void |
dispose()
A lifecycle method where implementor should free up any resources.
|
List<MessageSource> |
getSources() |
void |
initialise()
Method used to perform any initialisation work.
|
void |
removeSource(MessageSource source) |
void |
setFlowConstruct(FlowConstruct pattern) |
void |
setListener(MessageProcessor listener)
Set the MessageProcessor listener on a message source which will be invoked
when a message is received or generated.
|
void |
setMessageSources(List<MessageSource> sources) |
void |
setMuleContext(MuleContext context) |
void |
start() |
void |
stop() |
String |
toString() |
protected static final Log log
protected MessageProcessor listener
protected AtomicBoolean initialised
protected AtomicBoolean started
protected final List<MessageSource> sources
protected AtomicBoolean starting
protected FlowConstruct flowConstruct
protected MuleContext muleContext
public void addSource(MessageSource source) throws MuleException
addSource
in interface CompositeMessageSource
MuleException
public void removeSource(MessageSource source) throws MuleException
removeSource
in interface CompositeMessageSource
MuleException
public void setMessageSources(List<MessageSource> sources) throws MuleException
MuleException
public void initialise() throws InitialisationException
Initialisable
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.initialise
in interface Initialisable
InitialisationException
- if a fatal error occurs causing the Mule instance to shutdownRecoverableException
- if an error occurs that can be recovered frompublic void start() throws MuleException
start
in interface Startable
MuleException
public void stop() throws MuleException
stop
in interface Stoppable
MuleException
public void dispose()
Disposable
dispose
in interface Disposable
public void setListener(MessageProcessor listener)
MessageSource
setListener
in interface MessageSource
public void setFlowConstruct(FlowConstruct pattern)
setFlowConstruct
in interface FlowConstructAware
public List<MessageSource> getSources()
getSources
in interface CompositeMessageSource
public void setMuleContext(MuleContext context)
setMuleContext
in interface MuleContextAware
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.