Class PollingTrigger
- java.lang.Object
-
- com.adaptris.core.AdaptrisMessageWorkerImp
-
- com.adaptris.core.AdaptrisMessageConsumerImp
-
- com.adaptris.core.AdaptrisPollingConsumer
-
- com.adaptris.core.PollingTrigger
-
- All Implemented Interfaces:
AdaptrisComponent
,AdaptrisMessageConsumer
,AdaptrisMessageWorker
,ComponentLifecycle
,ComponentLifecycleExtension
,MessageEventGenerator
,StateManagedComponent
@ComponentProfile(summary="Generate a static trigger message on a schedule", tag="consumer,base", recommended=NullConnection.class) public class PollingTrigger extends AdaptrisPollingConsumer
Periodically sends a template message to trigger a
Workflow
In the adapter configuration file this class is aliased as polling-trigger which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
PollingTrigger.MessageProvider
How to generate the template that will be sent to the workflow.-
Nested classes/interfaces inherited from class com.adaptris.core.AdaptrisPollingConsumer
AdaptrisPollingConsumer.LockOperator
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.AdaptrisMessageWorkerImp
log
-
-
Constructor Summary
Constructors Constructor Description PollingTrigger()
PollingTrigger(Poller p)
PollingTrigger(Poller p, PollingTrigger.MessageProvider t)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the component.PollingTrigger.MessageProvider
getMessageProvider()
void
init()
Initialises the component.protected void
prepareConsumer()
protected int
processMessages()
Sends a newAdaptrisMessage
with the configured template as its payload using the configured producer.void
setMessageProvider(PollingTrigger.MessageProvider p)
void
start()
Starts the component.void
stop()
Stop the component-
Methods inherited from class com.adaptris.core.AdaptrisPollingConsumer
continueProcessingMessages, getMaxMessagesPerPoll, getPoller, getReacquireLockBetweenMessages, prepare, releaseLock, setMaxMessagesPerPoll, setPoller, setReacquireLockBetweenMessages
-
Methods inherited from class com.adaptris.core.AdaptrisMessageConsumerImp
changeState, newThreadName, registerAdaptrisMessageListener, renameThread, requestClose, requestInit, requestStart, requestStop, retrieveAdaptrisMessageListener, retrieveComponentState
-
Methods inherited from class com.adaptris.core.AdaptrisMessageWorkerImp
createName, createQualifier, decode, encode, getEncoder, getIsTrackingEndpoint, getMessageFactory, getUniqueId, handleConnectionException, isTrackingEndpoint, registerConnection, registerEncoderMessageFactory, retrieveConnection, setEncoder, setIsTrackingEndpoint, setMessageFactory, setUniqueId, withMessageFactory, withUniqueID
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.AdaptrisComponent
getUniqueId
-
Methods inherited from interface com.adaptris.core.AdaptrisMessageConsumer
consumeLocationKey
-
Methods inherited from interface com.adaptris.core.AdaptrisMessageWorker
decode, encode, getEncoder, getMessageFactory, handleConnectionException, registerConnection, retrieveConnection, setEncoder, setMessageFactory
-
Methods inherited from interface com.adaptris.core.MessageEventGenerator
createName, createQualifier, isTrackingEndpoint
-
-
-
-
Constructor Detail
-
PollingTrigger
public PollingTrigger()
-
PollingTrigger
public PollingTrigger(Poller p, PollingTrigger.MessageProvider t)
-
PollingTrigger
public PollingTrigger(Poller p)
-
-
Method Detail
-
prepareConsumer
protected void prepareConsumer() throws CoreException
- Specified by:
prepareConsumer
in classAdaptrisPollingConsumer
- Throws:
CoreException
-
processMessages
protected int processMessages()
Sends a new
AdaptrisMessage
with the configured template as its payload using the configured producer.- Specified by:
processMessages
in classAdaptrisPollingConsumer
- Returns:
- 1 as a single message is always produced
-
init
public void init() throws CoreException
Description copied from interface:ComponentLifecycle
Initialises the component.Component initialisation includes config verification, creation of connections etc.
- Specified by:
init
in interfaceComponentLifecycle
- Overrides:
init
in classAdaptrisPollingConsumer
- Throws:
CoreException
- wrapping any underlyingException
s- See Also:
ComponentLifecycle.init()
-
start
public void start() throws CoreException
Description copied from interface:ComponentLifecycle
Starts the component.Once a component is started it should be ready to process messages. In the case of
AdaptrisMessageConsumer
, calling start will begin message delivery.- Specified by:
start
in interfaceComponentLifecycle
- Overrides:
start
in classAdaptrisPollingConsumer
- Throws:
CoreException
- wrapping any underlyingException
s- See Also:
ComponentLifecycle.start()
-
stop
public void stop()
Description copied from interface:ComponentLifecycle
Stop the componentA stopped component is not expected to be ready to process messages. In the case of
AdaptrisMessageConsumer
, calling stop will pause message delivery. Throwing aRuntimeException
may cause unintended consequences- Specified by:
stop
in interfaceComponentLifecycle
- Overrides:
stop
in classAdaptrisPollingConsumer
- See Also:
ComponentLifecycle.stop()
-
close
public void close()
Description copied from interface:ComponentLifecycle
Closes the component.A closed component should release any connections it uses, etc. and clean up completely. Throwing a
RuntimeException
may cause unintended consequences- Specified by:
close
in interfaceComponentLifecycle
- Overrides:
close
in classAdaptrisPollingConsumer
- See Also:
ComponentLifecycle.close()
-
getMessageProvider
public PollingTrigger.MessageProvider getMessageProvider()
- Returns:
- the templateProvider
-
setMessageProvider
public void setMessageProvider(PollingTrigger.MessageProvider p)
- Parameters:
p
- the templateProvider to set
-
-