Package io.temporal.common.interceptors
Interface WorkerInterceptor
-
- All Known Implementing Classes:
WorkerInterceptorBase
public interface WorkerInterceptorIntercepts workflow and activity executions.Prefer extending
WorkerInterceptorBaseand overriding only the methods you need instead of implementing this interface directly.WorkerInterceptorBaseprovides correct default implementations to all the methods of this interface.You may want to start your implementation with this initial structure:
public class CustomWorkerInterceptor extends WorkerInterceptorBase { // remove if you don't need to have a custom WorkflowInboundCallsInterceptor or // WorkflowOutboundCallsInterceptor @Override public WorkflowInboundCallsInterceptor interceptWorkflow(WorkflowInboundCallsInterceptor next) { return new CustomWorkflowInboundCallsInterceptor(next) { // remove if you don't need to have a custom WorkflowOutboundCallsInterceptor @Override public void init(WorkflowOutboundCallsInterceptor outboundCalls) { next.init(new CustomWorkflowOutboundCallsInterceptor(outboundCalls)); } }; } // remove if you don't need to have a custom ActivityInboundCallsInterceptor @Override public ActivityInboundCallsInterceptor interceptActivity(ActivityInboundCallsInterceptor next) { return new CustomActivityInboundCallsInterceptor(next); } private static class CustomWorkflowInboundCallsInterceptor extends WorkflowInboundCallsInterceptorBase { public CustomWorkflowInboundCallsInterceptor(WorkflowInboundCallsInterceptor next) { super(next); } // override only the methods you need } private static class CustomWorkflowOutboundCallsInterceptor extends WorkflowOutboundCallsInterceptorBase { public CustomWorkflowOutboundCallsInterceptor(WorkflowOutboundCallsInterceptor next) { super(next); } // override only the methods you need } private static class CustomActivityInboundCallsInterceptor extends ActivityInboundCallsInterceptorBase { public CustomActivityInboundCallsInterceptor(ActivityInboundCallsInterceptor next) { super(next); } // override only the methods you need } }
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ActivityInboundCallsInterceptorinterceptActivity(ActivityInboundCallsInterceptor next)NexusOperationInboundCallsInterceptorinterceptNexusOperation(io.nexusrpc.handler.OperationContext context, NexusOperationInboundCallsInterceptor next)Called when Nexus task is received.WorkflowInboundCallsInterceptorinterceptWorkflow(WorkflowInboundCallsInterceptor next)Called when workflow class is instantiated.
-
-
-
Method Detail
-
interceptWorkflow
WorkflowInboundCallsInterceptor interceptWorkflow(WorkflowInboundCallsInterceptor next)
Called when workflow class is instantiated. May create aWorkflowInboundCallsInterceptorinstance. The instance must forward all the calls tonextWorkflowInboundCallsInterceptor, but it may change the input parameters.- Parameters:
next- an existing interceptor instance to be proxied by the interceptor created inside this method- Returns:
- an interceptor that passes all the calls to
next
-
interceptActivity
ActivityInboundCallsInterceptor interceptActivity(ActivityInboundCallsInterceptor next)
-
interceptNexusOperation
NexusOperationInboundCallsInterceptor interceptNexusOperation(io.nexusrpc.handler.OperationContext context, NexusOperationInboundCallsInterceptor next)
Called when Nexus task is received. May create aNexusOperationInboundCallsInterceptorinstance. The instance must forward all the calls tonextNexusOperationInboundCallsInterceptor, but it may change the input parameters.- Parameters:
next- an existing interceptor instance to be proxied by the interceptor created inside this method- Returns:
- an interceptor that passes all the calls to
next
-
-