-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for @GlobalInterceptor on producer methods
Fixes #21358
- Loading branch information
Showing
10 changed files
with
169 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...-interceptors/src/main/java/io/quarkus/grpc/examples/interceptors/ClientInterceptors.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package io.quarkus.grpc.examples.interceptors; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.enterprise.inject.Produces; | ||
|
||
import io.grpc.CallOptions; | ||
import io.grpc.Channel; | ||
import io.grpc.ClientCall; | ||
import io.grpc.ClientInterceptor; | ||
import io.grpc.MethodDescriptor; | ||
import io.quarkus.grpc.GlobalInterceptor; | ||
|
||
class ClientInterceptors { | ||
@GlobalInterceptor | ||
@ApplicationScoped | ||
static class TypeTarget extends Base { | ||
} | ||
|
||
static class MethodTarget extends Base { | ||
} | ||
|
||
static class Producer { | ||
@GlobalInterceptor | ||
@Produces | ||
MethodTarget methodTarget() { | ||
return new MethodTarget(); | ||
} | ||
} | ||
|
||
abstract static class Base implements ClientInterceptor { | ||
@Override | ||
public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> method, CallOptions options, | ||
Channel next) { | ||
HelloWorldEndpoint.invoked.add(getClass().getName()); | ||
return next.newCall(method, options); | ||
} | ||
} | ||
} |
58 changes: 0 additions & 58 deletions
58
...rceptors/src/main/java/io/quarkus/grpc/examples/interceptors/HeaderClientInterceptor.java
This file was deleted.
Oops, something went wrong.
43 changes: 0 additions & 43 deletions
43
...rceptors/src/main/java/io/quarkus/grpc/examples/interceptors/HeaderServerInterceptor.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...-interceptors/src/main/java/io/quarkus/grpc/examples/interceptors/ServerInterceptors.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package io.quarkus.grpc.examples.interceptors; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.enterprise.inject.Produces; | ||
|
||
import io.grpc.Metadata; | ||
import io.grpc.ServerCall; | ||
import io.grpc.ServerCallHandler; | ||
import io.grpc.ServerInterceptor; | ||
import io.quarkus.grpc.GlobalInterceptor; | ||
|
||
class ServerInterceptors { | ||
@GlobalInterceptor | ||
@ApplicationScoped | ||
static class TypeTarget extends Base { | ||
} | ||
|
||
static class MethodTarget extends Base { | ||
} | ||
|
||
static class Producer { | ||
@GlobalInterceptor | ||
@Produces | ||
MethodTarget methodTarget() { | ||
return new MethodTarget(); | ||
} | ||
} | ||
|
||
abstract static class Base implements ServerInterceptor { | ||
@Override | ||
public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(ServerCall<ReqT, RespT> call, Metadata metadata, | ||
ServerCallHandler<ReqT, RespT> next) { | ||
HelloWorldEndpoint.invoked.add(getClass().getName()); | ||
return next.startCall(call, metadata); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters