Skip to content

Commit 8ba9017

Browse files
committed
use WorkerInterceptorBase
1 parent cff098d commit 8ba9017

File tree

3 files changed

+8
-33
lines changed

3 files changed

+8
-33
lines changed

core/src/main/java/io/temporal/samples/countinterceptor/SimpleCountWorkerInterceptor.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@
2020
package io.temporal.samples.countinterceptor;
2121

2222
import io.nexusrpc.handler.OperationContext;
23-
import io.temporal.common.interceptors.ActivityInboundCallsInterceptor;
24-
import io.temporal.common.interceptors.NexusOperationInboundCallsInterceptor;
25-
import io.temporal.common.interceptors.WorkerInterceptor;
26-
import io.temporal.common.interceptors.WorkflowInboundCallsInterceptor;
23+
import io.temporal.common.interceptors.*;
24+
import io.temporal.internal.sync.BaseRootWorkflowInboundCallsInterceptor;
2725

28-
public class SimpleCountWorkerInterceptor implements WorkerInterceptor {
26+
public class SimpleCountWorkerInterceptor extends WorkerInterceptorBase {
2927

3028
@Override
3129
public WorkflowInboundCallsInterceptor interceptWorkflow(WorkflowInboundCallsInterceptor next) {
@@ -36,10 +34,4 @@ public WorkflowInboundCallsInterceptor interceptWorkflow(WorkflowInboundCallsInt
3634
public ActivityInboundCallsInterceptor interceptActivity(ActivityInboundCallsInterceptor next) {
3735
return new SimpleCountActivityInboundCallsInterceptor(next);
3836
}
39-
40-
@Override
41-
public NexusOperationInboundCallsInterceptor interceptNexusOperation(
42-
OperationContext context, NexusOperationInboundCallsInterceptor next) {
43-
return next;
44-
}
4537
}

core/src/main/java/io/temporal/samples/excludefrominterceptor/interceptor/MyWorkerInterceptor.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,12 @@
2020
package io.temporal.samples.excludefrominterceptor.interceptor;
2121

2222
import io.nexusrpc.handler.OperationContext;
23-
import io.temporal.common.interceptors.ActivityInboundCallsInterceptor;
24-
import io.temporal.common.interceptors.NexusOperationInboundCallsInterceptor;
25-
import io.temporal.common.interceptors.WorkerInterceptor;
26-
import io.temporal.common.interceptors.WorkflowInboundCallsInterceptor;
23+
import io.temporal.common.interceptors.*;
24+
2725
import java.util.ArrayList;
2826
import java.util.List;
2927

30-
public class MyWorkerInterceptor implements WorkerInterceptor {
28+
public class MyWorkerInterceptor extends WorkerInterceptorBase {
3129
private List<String> excludeWorkflowTypes = new ArrayList<>();
3230
private List<String> excludeActivityTypes = new ArrayList<>();
3331

@@ -51,10 +49,4 @@ public WorkflowInboundCallsInterceptor interceptWorkflow(WorkflowInboundCallsInt
5149
public ActivityInboundCallsInterceptor interceptActivity(ActivityInboundCallsInterceptor next) {
5250
return new MyActivityInboundCallsInterceptor(excludeActivityTypes, next);
5351
}
54-
55-
@Override
56-
public NexusOperationInboundCallsInterceptor interceptNexusOperation(
57-
OperationContext context, NexusOperationInboundCallsInterceptor next) {
58-
return next;
59-
}
6052
}

core/src/main/java/io/temporal/samples/retryonsignalinterceptor/RetryOnSignalWorkerInterceptor.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,10 @@
2020
package io.temporal.samples.retryonsignalinterceptor;
2121

2222
import io.nexusrpc.handler.OperationContext;
23-
import io.temporal.common.interceptors.ActivityInboundCallsInterceptor;
24-
import io.temporal.common.interceptors.NexusOperationInboundCallsInterceptor;
25-
import io.temporal.common.interceptors.WorkerInterceptor;
26-
import io.temporal.common.interceptors.WorkflowInboundCallsInterceptor;
23+
import io.temporal.common.interceptors.*;
2724

2825
/** Should be registered through WorkerFactoryOptions. */
29-
public class RetryOnSignalWorkerInterceptor implements WorkerInterceptor {
26+
public class RetryOnSignalWorkerInterceptor extends WorkerInterceptorBase {
3027
@Override
3128
public WorkflowInboundCallsInterceptor interceptWorkflow(WorkflowInboundCallsInterceptor next) {
3229
return new RetryOnSignalWorkflowInboundCallsInterceptor(next);
@@ -36,10 +33,4 @@ public WorkflowInboundCallsInterceptor interceptWorkflow(WorkflowInboundCallsInt
3633
public ActivityInboundCallsInterceptor interceptActivity(ActivityInboundCallsInterceptor next) {
3734
return next;
3835
}
39-
40-
@Override
41-
public NexusOperationInboundCallsInterceptor interceptNexusOperation(
42-
OperationContext context, NexusOperationInboundCallsInterceptor next) {
43-
return next;
44-
}
4536
}

0 commit comments

Comments
 (0)