question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: Custom interceptor

See original GitHub issue

Hi,

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:closed
  • Created 5 years ago
  • Reactions:9
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

9reactions
stanley-cheungcommented, Sep 7, 2018

We have plans to add Interceptor support in the future. We will start with an API proposal first.

7reactions
rogchapcommented, Apr 15, 2019

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found