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

Support registering a ClientHeadersFactory in the rest client programmatic API #32189

Closed
vsevel opened this issue Mar 28, 2023 · 9 comments · Fixed by #32880
Closed

Support registering a ClientHeadersFactory in the rest client programmatic API #32189

vsevel opened this issue Mar 28, 2023 · 9 comments · Fixed by #32880
Labels
Milestone

Comments

@vsevel
Copy link
Contributor

vsevel commented Mar 28, 2023

Description

It would be useful to be able to register client headers factories through the programmatic API. Example :

@Inject
RequestUUIDHeaderFactory  factory;
...
MyService myService = RestClientBuilder.newBuilder()
            .baseUri(URI.create("https://stage.code.quarkus.io/api"))
            .clientHeadersFactory(factory)
            .build(MyService.class);

Using a programmatic rest client is one solution when using a rest interface coming from a jar external to the application (most likely coming from non quarkus applications). In that case it is not possible to add additional quarkus annotations, such as @RegisterRestClient or @RegisterClientHeaders.

See this zulip chat

Implementation ideas

No response

@vsevel vsevel added the kind/enhancement New feature or request label Mar 28, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented Mar 28, 2023

You added a link to a Zulip discussion, please make sure the description of the issue is comprehensive and doesn't require accessing Zulip

This message is automatically generated by a bot.

@quarkus-bot
Copy link

quarkus-bot bot commented Mar 28, 2023

/cc @Sgitario (rest-client), @cescoffier (rest-client), @geoand (rest-client)

@geoand
Copy link
Contributor

geoand commented Mar 29, 2023

Thanks for reporting!

@geoand
Copy link
Contributor

geoand commented Apr 12, 2023

@radcortez this sounds like something that should be taken up with the spec, right?

@radcortez
Copy link
Member

Yes, but this was requested a long time ago without considerable progress:
eclipse/microprofile-rest-client#283

Maybe we need to consider providing our own enhanced ClientBuilder API.

@geoand
Copy link
Contributor

geoand commented Apr 13, 2023

Maybe we need to consider providing our own enhanced ClientBuilder API

+1

@WesleyBlancoYuan
Copy link

WesleyBlancoYuan commented Apr 18, 2023

+1 for external classes. In my case I have OpenAPI codegen classes and it's just a restClient but I cannot enable injection by adding annotations to it. For now I define a Quarkus client which extends the generated class, as here. A workaround, even I cannot use CompletionStage directly, but I need to supplyAsync() in the caller.

@Sgitario
Copy link
Contributor

Maybe we need to consider providing our own enhanced ClientBuilder API

+1

I've created this issue #32856 for this.

@Sgitario
Copy link
Contributor

#32880 should take care of this feature request.

@quarkus-bot quarkus-bot bot added this to the 3.1 - main milestone Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants