Class SyncWorkflowWorker
java.lang.Object
io.temporal.internal.worker.SyncWorkflowWorker
- All Implemented Interfaces:
Shutdownable,Startable,Suspendable,SuspendableWorker,WorkerWithLifecycle
Facade that supports a lifecycle and maintains an assembly of
WorkflowWorkerthat performing execution of workflow taskLocalActivityWorkerthat performs execution of local activities scheduled by the workflow tasks
-
Constructor Summary
ConstructorsConstructorDescriptionSyncWorkflowWorker(WorkflowClient client, String namespace, String taskQueue, SingleWorkerOptions singleWorkerOptions, SingleWorkerOptions localActivityOptions, WorkflowRunLockManager runLocks, WorkflowExecutorCache cache, String stickyTaskQueueName, WorkflowThreadExecutor workflowThreadExecutor, EagerActivityDispatcher eagerActivityDispatcher, SlotSupplier<WorkflowSlotInfo> slotSupplier, SlotSupplier<LocalActivitySlotInfo> laSlotSupplier, NamespaceCapabilities namespaceCapabilities) -
Method Summary
Modifier and TypeMethodDescriptionvoidawaitTermination(long timeout, TimeUnit unit) booleanbooleanbooleanbooleanboolean<R> RqueryWorkflowExecution(WorkflowExecutionHistory history, String queryType, Class<R> resultClass, Type resultType, Object[] args) voidregisterLocalActivityImplementations(Object... activitiesImplementation) <R> voidregisterWorkflowImplementationFactory(WorkflowImplementationOptions options, Class<R> clazz, Functions.Func<R> factory) <R> voidregisterWorkflowImplementationFactory(WorkflowImplementationOptions options, Class<R> clazz, Functions.Func1<EncodedValues, R> factory) voidregisterWorkflowImplementationTypes(WorkflowImplementationOptions options, Class<?>[] workflowImplementationTypes) voidAllow new poll requests.shutdown(ShutdownManager shutdownManager, boolean interruptTasks) booleanstart()This method is not required to be idempotent.voidDo not make new poll requests.toString()
-
Constructor Details
-
SyncWorkflowWorker
public SyncWorkflowWorker(@Nonnull WorkflowClient client, @Nonnull String namespace, @Nonnull String taskQueue, @Nonnull SingleWorkerOptions singleWorkerOptions, @Nonnull SingleWorkerOptions localActivityOptions, @Nonnull WorkflowRunLockManager runLocks, @Nonnull WorkflowExecutorCache cache, String stickyTaskQueueName, @Nonnull WorkflowThreadExecutor workflowThreadExecutor, @Nonnull EagerActivityDispatcher eagerActivityDispatcher, @Nonnull SlotSupplier<WorkflowSlotInfo> slotSupplier, @Nonnull SlotSupplier<LocalActivitySlotInfo> laSlotSupplier, @Nonnull NamespaceCapabilities namespaceCapabilities)
-
-
Method Details
-
registerWorkflowImplementationTypes
public void registerWorkflowImplementationTypes(WorkflowImplementationOptions options, Class<?>[] workflowImplementationTypes) -
registerWorkflowImplementationFactory
public <R> void registerWorkflowImplementationFactory(WorkflowImplementationOptions options, Class<R> clazz, Functions.Func<R> factory) -
registerWorkflowImplementationFactory
public <R> void registerWorkflowImplementationFactory(WorkflowImplementationOptions options, Class<R> clazz, Functions.Func1<EncodedValues, R> factory) -
registerLocalActivityImplementations
-
start
public boolean start()Description copied from interface:StartableThis method is not required to be idempotent. It is expected to be called only once. -
shutdown
- Specified by:
shutdownin interfaceShutdownable- Parameters:
shutdownManager- provides toolset to get a Future for a shutdown of instances that have both non-blocking and not returning a Future on a completion shutdown methods (likeExecutorService.shutdown())interruptTasks- if the threads processing user code (like workflows, workflow tasks or activities) should be interrupted, or we want to wait for their full graceful completion- Returns:
- CompletableFuture which should be completed when awaiting downstream dependencies can
proceed with their own shutdown. Should never be completed exceptionally
CompletableFuture.exceptionally(Function)as downstream dependencies have no use of this information (they need to perform a shutdown anyway), and it complicates the shutdown flow.
-
awaitTermination
- Specified by:
awaitTerminationin interfaceShutdownable
-
suspendPolling
public void suspendPolling()Description copied from interface:SuspendableDo not make new poll requests. Outstanding long polls still can return tasks after this method was called.- Specified by:
suspendPollingin interfaceSuspendable
-
resumePolling
public void resumePolling()Description copied from interface:SuspendableAllow new poll requests.- Specified by:
resumePollingin interfaceSuspendable
-
queryWorkflowExecution
-
isSuspended
public boolean isSuspended()- Specified by:
isSuspendedin interfaceSuspendable
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceShutdownable
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceShutdownable
-
getLifecycleState
- Specified by:
getLifecycleStatein interfaceWorkerWithLifecycle
-
getWorkflowSlotSupplier
-
getLocalActivitySlotSupplier
-
hasStickyQueue
public boolean hasStickyQueue() -
isAnyTypeSupported
public boolean isAnyTypeSupported() -
getWorkflowTaskCounter
-
getLocalActivityTaskCounter
-
getWorkflowPollerOptions
-
getWorkflowPollerTracker
-
getStickyPollerTracker
-
getStickyTaskQueueName
-
toString
-
reserveWorkflowExecutor
-