public final class WorkerFactory
extends java.lang.Object
Constructor and Description |
---|
WorkerFactory(WorkflowClient workflowClient,
WorkerFactoryOptions factoryOptions)
Creates a factory.
|
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.
|
WorkflowClient |
getWorkflowClient() |
java.util.concurrent.CompletableFuture<java.lang.Boolean> |
isHealthy()
Checks if we have a valid connection to the Cadence cluster, and potentially resets the peer
list
|
boolean |
isShutdown()
Was
shutdown() or shutdownNow() called. |
boolean |
isStarted()
Was
start() called. |
boolean |
isTerminated()
Returns true if all tasks have completed following shut down.
|
static WorkerFactory |
newInstance(WorkflowClient workflowClient) |
static WorkerFactory |
newInstance(WorkflowClient workflowClient,
WorkerFactoryOptions options) |
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 WorkerFactory(WorkflowClient workflowClient, WorkerFactoryOptions factoryOptions)
workflowClient
- client to the Cadence Service endpoint.factoryOptions
- Options used to configure factory settingspublic static WorkerFactory newInstance(WorkflowClient workflowClient)
public static WorkerFactory newInstance(WorkflowClient workflowClient, WorkerFactoryOptions options)
public 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 WorkflowClient getWorkflowClient()
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 java.util.concurrent.CompletableFuture<java.lang.Boolean> isHealthy()
public void awaitTermination(long timeout, java.util.concurrent.TimeUnit unit)
public void suspendPolling()
public void resumePolling()