Interface WorkerInterceptor
- All Known Implementing Classes:
WorkerInterceptorBase
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
Modifier and TypeMethodDescriptioninterceptNexusOperation(io.nexusrpc.handler.OperationContext context, NexusOperationInboundCallsInterceptor next) Called when Nexus task is received.Called when workflow class is instantiated.
-
Method Details
-
interceptWorkflow
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
-
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
-