Package io.temporal.common.interceptors
Interface WorkerInterceptor
-
- All Known Implementing Classes:
WorkerInterceptorBase
public interface WorkerInterceptor
Intercepts workflow and activity executions.Prefer extending
WorkerInterceptorBase
and overriding only the methods you need instead of implementing this interface directly.WorkerInterceptorBase
provides 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 ActivityInboundCallsInterceptor
interceptActivity(ActivityInboundCallsInterceptor next)
WorkflowInboundCallsInterceptor
interceptWorkflow(WorkflowInboundCallsInterceptor next)
Called when workflow class is instantiated.
-
-
-
Method Detail
-
interceptWorkflow
WorkflowInboundCallsInterceptor interceptWorkflow(WorkflowInboundCallsInterceptor next)
Called when workflow class is instantiated. May create aWorkflowInboundCallsInterceptor
instance. The instance must forward all the calls tonext
WorkflowInboundCallsInterceptor
, 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)
-
-