Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify adding gRPC headers #19209

Closed
michalszynkiewicz opened this issue Aug 3, 2021 · 2 comments · Fixed by #19646
Closed

Simplify adding gRPC headers #19209

michalszynkiewicz opened this issue Aug 3, 2021 · 2 comments · Fixed by #19646
Assignees
Labels
area/grpc gRPC kind/enhancement New feature or request
Milestone

Comments

@michalszynkiewicz
Copy link
Member

michalszynkiewicz commented Aug 3, 2021

Description

Add an easy way to set headers for a grpc call

ATM, we can do:

        Metadata extraHeaders = new Metadata();
        extraHeaders.put(EXTRA_HEADER, "my-extra-value");
        MutinyGreeterGrpc.MutinyGreeterStub alteredClient = MetadataUtils.attachHeaders(mutinyHelloClient, extraHeaders);
        alteredClient.sayHello...

Simiarily for the blocking client.

It gets a bit more complicated with the interface-based client:

        Metadata extraHeaders = new Metadata();
        extraHeaders.put(INTERFACE_HEADER, "my-interface-value");
 
        MutinyGreeterGrpc.MutinyGreeterStub stub = ((GreeterClient) interfaceHelloClient).getStub();
        MutinyGreeterGrpc.MutinyGreeterStub alteredClient = MetadataUtils.attachHeaders(stub, extraHeaders);

        alteredClient.sayHello...

Implementation ideas

No response

@michalszynkiewicz michalszynkiewicz added the kind/enhancement New feature or request label Aug 3, 2021
@michalszynkiewicz michalszynkiewicz self-assigned this Aug 3, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Aug 3, 2021

/cc @cescoffier

@quarkus-bot quarkus-bot bot added the area/grpc gRPC label Aug 3, 2021
@michalszynkiewicz michalszynkiewicz changed the title gRPC headers Simplify adding gRPC headers Aug 4, 2021
@michalszynkiewicz
Copy link
Member Author

CC @mkouba

michalszynkiewicz added a commit to michalszynkiewicz/quarkus that referenced this issue Aug 25, 2021
michalszynkiewicz added a commit to michalszynkiewicz/quarkus that referenced this issue Aug 26, 2021
@quarkus-bot quarkus-bot bot added this to the 2.3 - main milestone Aug 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/grpc gRPC kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant