public final class WorkerFactory
extends java.lang.Object
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() |
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 taskQueue)
Creates worker that connects to an instance of the Temporal Service.
|
Worker |
newWorker(java.lang.String taskQueue,
WorkerOptions options)
Creates worker that connects to an instance of the Temporal Service.
|
void |
resumePolling() |
void |
shutdown()
Initiates an orderly shutdown in which polls are stopped and already received workflow and
activity tasks are executed.
|
void |
shutdownNow()
Initiates an orderly shutdown in which polls are stopped and already received workflow and
activity tasks are attempted to be stopped.
|
void |
start()
Starts all the workers created by this factory.
|
void |
suspendPolling() |
public static WorkerFactory newInstance(WorkflowClient workflowClient)
public static WorkerFactory newInstance(WorkflowClient workflowClient, WorkerFactoryOptions options)
public Worker newWorker(java.lang.String taskQueue)
taskQueue
- task queue name worker uses to poll. It uses this name for both workflow and
activity task queue polls.public Worker newWorker(java.lang.String taskQueue, WorkerOptions options)
taskQueue
- task queue name worker uses to poll. It uses this name for both workflow and
activity task queue 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()
ActivityExecutionContext.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()
ActivityExecutionContext.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()