public static final class Worker.Factory
extends java.lang.Object
Constructor and Description |
---|
Factory(IWorkflowService workflowService,
java.lang.String domain)
Creates a factory.
|
Factory(IWorkflowService workflowService,
java.lang.String domain,
Worker.FactoryOptions factoryOptions)
Creates a factory.
|
Factory(java.lang.String domain)
Creates a factory.
|
Factory(java.lang.String host,
int port,
java.lang.String domain)
Creates a factory.
|
Factory(java.lang.String host,
int port,
java.lang.String domain,
Worker.FactoryOptions factoryOptions)
Creates a factory.
|
Factory(java.lang.String domain,
Worker.FactoryOptions factoryOptions)
Creates a factory connected to a local deployment of cadence-server.
|
Modifier and Type | Method and Description |
---|---|
void |
awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
Blocks until all tasks have completed execution after a shutdown request, or the timeout
occurs, or the current thread is interrupted, whichever happens first.
|
IWorkflowService |
getWorkflowService() |
boolean |
isShutdown()
Was
shutdown() or shutdownNow() called. |
boolean |
isStarted()
Was
start() called. |
boolean |
isTerminated()
Returns true if all tasks have completed following shut down.
|
Worker |
newWorker(java.lang.String taskList)
Creates worker that connects to an instance of the Cadence Service.
|
Worker |
newWorker(java.lang.String taskList,
WorkerOptions options)
Creates worker that connects to an instance of the Cadence Service.
|
void |
resumePolling() |
void |
shutdown()
Initiates an orderly shutdown in which polls are stopped and already received decision and
activity tasks are executed.
|
void |
shutdownNow()
Initiates an orderly shutdown in which polls are stopped and already received decision and
activity tasks are attempted to be stopped.
|
void |
start()
Starts all the workers created by this factory.
|
void |
suspendPolling() |
public Factory(java.lang.String domain)
domain
- Domain used by workers to poll for workflows.public Factory(java.lang.String host, int port, java.lang.String domain)
host
- host used by the underlying workflowServiceClient to connect to.port
- port used by the underlying workflowServiceClient to connect to.domain
- Domain used by workers to poll for workflows.public Factory(java.lang.String domain, Worker.FactoryOptions factoryOptions)
domain
- Domain used by workers to poll for workflows.factoryOptions
- Options used to configure factory settingspublic Factory(java.lang.String host, int port, java.lang.String domain, Worker.FactoryOptions factoryOptions)
host
- host used by the underlying workflowServiceClient to connect to.port
- port used by the underlying workflowServiceClient to connect to.domain
- Domain used by workers to poll for workflows.factoryOptions
- Options used to configure factory settingspublic Factory(IWorkflowService workflowService, java.lang.String domain)
workflowService
- client to the Cadence Service endpoint.domain
- Domain used by workers to poll for workflows.public Factory(IWorkflowService workflowService, java.lang.String domain, Worker.FactoryOptions factoryOptions)
workflowService
- client to the Cadence Service endpoint.domain
- Domain used by workers to poll for workflows.factoryOptions
- Options used to configure factory settingspublic Worker newWorker(java.lang.String taskList)
taskList
- task list name worker uses to poll. It uses this name for both decision and
activity task list polls.public Worker newWorker(java.lang.String taskList, WorkerOptions options)
taskList
- task list name worker uses to poll. It uses this name for both decision and
activity task list polls.options
- Options (like DataConverter
override) for configuring worker.public void start()
public boolean isStarted()
start()
called.public boolean isShutdown()
shutdown()
or shutdownNow()
called.public boolean isTerminated()
public IWorkflowService getWorkflowService()
public void shutdown()
Activity.heartbeat(Object)
start throwing ActivityWorkerShutdownException
. Invocation has no additional effect
if already shut down. This method does not wait for previously received tasks to complete
execution. Use awaitTermination(long, TimeUnit)
to do that.public void shutdownNow()
Activity.heartbeat(Object)
start throwing ActivityWorkerShutdownException
. Invocation
has no additional effect if already shut down. This method does not wait for previously
received tasks to complete execution. Use awaitTermination(long, TimeUnit)
to do
that.public void awaitTermination(long timeout, java.util.concurrent.TimeUnit unit)
public void suspendPolling()
public void resumePolling()