Question: Custom interceptor
See original GitHub issueHi,
is it possible to write a custom interceptor? Can i access the custom metadata?
In kotlin i do something like this:
CustomInterceptor : ServerInterceptor{
private var codeKey: Metadata.Key<Int> = Metadata.Key.of("meta1", IntMarshaller())
private var messageKey: Metadata.Key<String> = Metadata.Key.of("meta2", UTF8Marshaller())
override fun <ReqT : Any?, RespT : Any?> interceptCall(call: ServerCall<ReqT, RespT>?, headers: Metadata?, next: ServerCallHandler<ReqT, RespT>?): ServerCall.Listener<ReqT> {
val delegate = next!!.startCall(call, headers)
return object : SimpleForwardingServerCallListener<ReqT>(delegate) {
override fun onHalfClose() {
call?.close(Status.UNKNOWN, customMetadata)
}
}
}
}}
Issue Analytics
- State:
- Created 5 years ago
- Reactions:9
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Adding a custom interceptor for some actions - Stack Overflow
You seem to think that the default Interceptor Stack applies to all actions, and that the eventual interceptor you're specifying for to the ......
Read more >How to create custom interceptor on custom table s...
Hi,. Setup by going to interceptor in navigation filter. Below link will be helpful to set it up. Also look at other interceptors...
Read more >how can configure interceptor for custom item type
First, you have to implement an interceptor. For e.g. lets create a prepare interceptor for item type "xyz" package my.package; public class ...
Read more >Spring MVC Interceptor HandlerInterceptorAdapter ...
Developer and author at DigitalOcean. Spring MVC Interceptor HandlerInterceptorAdapter, HandlerInterceptor Example. While we believe that this ...
Read more >Custom Interceptor for Various Transformers/Components
My requirement is an custom envelope interceptor which is useable for all ... adding-logging-to-a-flow.xml /echoexample/src/main/app line 9 XML Problem.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We have plans to add Interceptor support in the future. We will start with an API proposal first.
Do we have any movement on client interceptors? Can we take the proposal for Node and port it for grpc-web? https://github.com/grpc/proposal/blob/master/L5-node-client-interceptors.md