|
Did this page help you?Yes No Tell us about it... |
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.amazonaws.services.simpleworkflow.flow.spring.SpringWorkflowWorker
public class SpringWorkflowWorker
To be used with Spring. Assumes that injected implementation bean has "workflow" scope. Otherwise the same object instance will be reused for multiple decisions which is guaranteed to break replay if any instance fields are used.
Constructor Summary | |
---|---|
SpringWorkflowWorker()
|
|
SpringWorkflowWorker(AmazonSimpleWorkflow service,
java.lang.String domain,
java.lang.String taskListToPoll)
|
Method Summary | |
---|---|
void |
addWorkflowImplementation(java.lang.Object workflowImplementation)
|
boolean |
awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
|
DataConverter |
getDataConverter()
|
java.lang.String |
getDomain()
|
long |
getDomainRetentionPeriodInDays()
|
java.lang.String |
getIdentity()
|
int |
getMaximumPollRateIntervalMilliseconds()
|
double |
getMaximumPollRatePerSecond()
|
int |
getPhase()
|
double |
getPollBackoffCoefficient()
|
long |
getPollBackoffInitialInterval()
|
long |
getPollBackoffMaximumInterval()
|
int |
getPollThreadCount()
|
AmazonSimpleWorkflow |
getService()
|
java.lang.String |
getTaskListToPoll()
Task list name that given worker polls for tasks. |
long |
getTerminationTimeoutSeconds()
|
java.lang.Thread.UncaughtExceptionHandler |
getUncaughtExceptionHandler()
|
java.lang.Iterable<java.lang.Object> |
getWorkflowImplementations()
|
java.lang.Iterable<WorkflowType> |
getWorkflowTypesToRegister()
|
boolean |
isAutoStartup()
|
boolean |
isDisableAutoStartup()
|
boolean |
isDisableServiceShutdownOnStop()
|
boolean |
isDisableTypeRegistrationOnStart()
|
boolean |
isRegisterDomain()
|
boolean |
isRunning()
|
void |
registerTypesToPoll()
Try to register every type (activity or workflow depending on worker) that are configured with the worker. |
void |
resumePolling()
Allow new poll requests. |
void |
setDataConverter(DataConverter converter)
|
void |
setDisableAutoStartup(boolean disableAutoStartup)
|
void |
setDisableServiceShutdownOnStop(boolean disableServiceShutdownOnStop)
When set to false (which is default) at the beginning of the worker shutdown AmazonSimpleWorkflow.shutdown() is called. |
void |
setDisableTypeRegistrationOnStart(boolean disableTypeRegistrationOnStart)
When set to true disables types registration on start even if SkipTypeRegistration is not specified. |
void |
setDomain(java.lang.String domain)
|
void |
setDomainRetentionPeriodInDays(long domainRetentionPeriodInDays)
Value of DomainRetentionPeriodInDays parameter passed to AmazonSimpleWorkflow.registerDomain(com.amazonaws.services.simpleworkflow.model.RegisterDomainRequest) call. |
void |
setIdentity(java.lang.String identity)
Set the identity that worker specifies in the poll requests. |
void |
setMaximumPollRateIntervalMilliseconds(int maximumPollRateIntervalMilliseconds)
The sliding window interval used to measure the poll rate. |
void |
setMaximumPollRatePerSecond(double maximumPollRatePerSecond)
Maximum number of poll request to the task list per second allowed. |
void |
setPhase(int startPhase)
|
void |
setPollBackoffCoefficient(double backoffCoefficient)
|
void |
setPollBackoffInitialInterval(long backoffInitialInterval)
Failed poll requests are retried after an interval defined by an exponential backoff algorithm. |
void |
setPollBackoffMaximumInterval(long backoffMaximumInterval)
|
void |
setPollThreadCount(int threadCount)
Defines how many concurrent threads are used by the given worker to poll the specified task list. |
void |
setRegisterDomain(boolean registerDomain)
Should domain be registered on startup. |
void |
setService(AmazonSimpleWorkflow service)
|
void |
setTaskListToPoll(java.lang.String taskListToPoll)
|
void |
setTerminationTimeoutSeconds(long terminationTimeoutSeconds)
|
void |
setUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionHandler)
Handler notified about poll request and other unexpected failures. |
void |
setWorkflowImplementations(java.lang.Iterable<java.lang.Object> workflowImplementations)
|
void |
shutdown()
|
boolean |
shutdownAndAwaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
|
void |
shutdownNow()
|
void |
start()
|
void |
stop()
|
void |
stop(java.lang.Runnable callback)
|
void |
stopNow()
|
void |
suspendPolling()
Do not make new poll requests. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SpringWorkflowWorker()
public SpringWorkflowWorker(AmazonSimpleWorkflow service, java.lang.String domain, java.lang.String taskListToPoll)
Method Detail |
---|
public AmazonSimpleWorkflow getService()
getService
in interface WorkerBase
public void setService(AmazonSimpleWorkflow service)
public java.lang.String getDomain()
getDomain
in interface WorkerBase
public void setDomain(java.lang.String domain)
public boolean isRegisterDomain()
isRegisterDomain
in interface WorkerBase
public void setRegisterDomain(boolean registerDomain)
WorkerBase
false
.
When enabled #setDomainRetentionPeriodInDays(Long)
property is
required.
setRegisterDomain
in interface WorkerBase
public long getDomainRetentionPeriodInDays()
getDomainRetentionPeriodInDays
in interface WorkerBase
public void setDomainRetentionPeriodInDays(long domainRetentionPeriodInDays)
WorkerBase
AmazonSimpleWorkflow.registerDomain(com.amazonaws.services.simpleworkflow.model.RegisterDomainRequest)
call. Required when
WorkerBase.isRegisterDomain()
is true
.
setDomainRetentionPeriodInDays
in interface WorkerBase
public java.lang.String getTaskListToPoll()
WorkerBase
getTaskListToPoll
in interface WorkerBase
public void setTaskListToPoll(java.lang.String taskListToPoll)
public DataConverter getDataConverter()
public void setDataConverter(DataConverter converter)
public double getMaximumPollRatePerSecond()
getMaximumPollRatePerSecond
in interface WorkerBase
public void setMaximumPollRatePerSecond(double maximumPollRatePerSecond)
WorkerBase
setMaximumPollRatePerSecond
in interface WorkerBase
WorkerBase.setMaximumPollRateIntervalMilliseconds(int)
public int getMaximumPollRateIntervalMilliseconds()
getMaximumPollRateIntervalMilliseconds
in interface WorkerBase
public void setMaximumPollRateIntervalMilliseconds(int maximumPollRateIntervalMilliseconds)
WorkerBase
setMaximumPollRateIntervalMilliseconds
in interface WorkerBase
WorkerBase.setMaximumPollRatePerSecond(double)
public java.lang.Thread.UncaughtExceptionHandler getUncaughtExceptionHandler()
getUncaughtExceptionHandler
in interface WorkerBase
public void setUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionHandler)
WorkerBase
setUncaughtExceptionHandler
in interface WorkerBase
public java.lang.String getIdentity()
getIdentity
in interface WorkerBase
public void setIdentity(java.lang.String identity)
WorkerBase
setIdentity
in interface WorkerBase
identity
- maximum size is 256 characters.public long getPollBackoffInitialInterval()
getPollBackoffInitialInterval
in interface WorkerBase
public void setPollBackoffInitialInterval(long backoffInitialInterval)
WorkerBase
setPollBackoffInitialInterval
in interface WorkerBase
backoffInitialInterval
- the interval between failure and the first retry. Default is
100.public long getPollBackoffMaximumInterval()
getPollBackoffMaximumInterval
in interface WorkerBase
public void setPollBackoffMaximumInterval(long backoffMaximumInterval)
setPollBackoffMaximumInterval
in interface WorkerBase
backoffMaximumInterval
- maximum interval between poll request retries. Default is
60000 (one minute).WorkerBase.setPollBackoffInitialInterval(long)
public boolean isDisableServiceShutdownOnStop()
isDisableServiceShutdownOnStop
in interface WorkerBase
public void setDisableServiceShutdownOnStop(boolean disableServiceShutdownOnStop)
WorkerBase
AmazonSimpleWorkflow.shutdown()
is called. It causes all
outstanding long poll request to disconnect. But also causes all future
request (for example activity completions) to SWF fail.
setDisableServiceShutdownOnStop
in interface WorkerBase
public void setDisableTypeRegistrationOnStart(boolean disableTypeRegistrationOnStart)
WorkerBase
SkipTypeRegistration
is not specified. Types still can be
registered by calling WorkerBase.registerTypesToPoll()
.
setDisableTypeRegistrationOnStart
in interface WorkerBase
public boolean isDisableTypeRegistrationOnStart()
isDisableTypeRegistrationOnStart
in interface WorkerBase
public double getPollBackoffCoefficient()
getPollBackoffCoefficient
in interface WorkerBase
public void setPollBackoffCoefficient(double backoffCoefficient)
setPollBackoffCoefficient
in interface WorkerBase
backoffCoefficient
- coefficient that defines how fast retry interval grows in case
of poll request failures. Default is 2.0.WorkerBase.setPollBackoffInitialInterval(long)
public int getPollThreadCount()
getPollThreadCount
in interface WorkerBase
public void setPollThreadCount(int threadCount)
WorkerBase
ActivityWorker
two separate threads pools are used. One for
polling and another one for executing activities. The size of the
activity execution thread pool is defined through
ActivityWorker.setTaskExecutorThreadPoolSize(int)
.
setPollThreadCount
in interface WorkerBase
public void suspendPolling()
Suspendable
suspendPolling
in interface Suspendable
public void resumePolling()
Suspendable
resumePolling
in interface Suspendable
public java.lang.Iterable<WorkflowType> getWorkflowTypesToRegister()
public void start()
start
in interface WorkerLifecycle
start
in interface org.springframework.context.Lifecycle
public void shutdown()
shutdown
in interface WorkerLifecycle
public void shutdownNow()
shutdownNow
in interface WorkerLifecycle
public boolean shutdownAndAwaitTermination(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
shutdownAndAwaitTermination
in interface WorkerLifecycle
java.lang.InterruptedException
public void stopNow()
public boolean awaitTermination(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
awaitTermination
in interface WorkerLifecycle
java.lang.InterruptedException
public void setWorkflowImplementations(java.lang.Iterable<java.lang.Object> workflowImplementations) throws java.lang.InstantiationException, java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.IllegalAccessException
public java.lang.Iterable<java.lang.Object> getWorkflowImplementations()
public void addWorkflowImplementation(java.lang.Object workflowImplementation) throws java.lang.InstantiationException, java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.IllegalAccessException
public java.lang.String toString()
toString
in class java.lang.Object
public void stop()
stop
in interface org.springframework.context.Lifecycle
public boolean isRunning()
isRunning
in interface WorkerBase
isRunning
in interface org.springframework.context.Lifecycle
public int getPhase()
getPhase
in interface org.springframework.context.Phased
public void setPhase(int startPhase)
public boolean isAutoStartup()
isAutoStartup
in interface org.springframework.context.SmartLifecycle
public long getTerminationTimeoutSeconds()
public void setTerminationTimeoutSeconds(long terminationTimeoutSeconds)
public boolean isDisableAutoStartup()
public void setDisableAutoStartup(boolean disableAutoStartup)
public void stop(java.lang.Runnable callback)
stop
in interface org.springframework.context.SmartLifecycle
public void registerTypesToPoll()
WorkerBase
registerTypesToPoll
in interface WorkerBase
WorkerBase.setDisableTypeRegistrationOnStart(boolean)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |