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

Introduce to inject DaprClient in the interfaces #5

Open
zhfeng opened this issue Apr 19, 2022 · 3 comments
Open

Introduce to inject DaprClient in the interfaces #5

zhfeng opened this issue Apr 19, 2022 · 3 comments
Assignees

Comments

@zhfeng
Copy link
Contributor

zhfeng commented Apr 19, 2022

It could be similar with @RegisterRestClient in quarkus. such as

@RegisterDaprClient
public interface someService {
    void invoke(String id);
}

We need to process this annotation with injecting the DaprClient and mapping the method to do invoking.

@naah69
Copy link
Contributor

naah69 commented Apr 20, 2022

yes,it need two annotations like @RegisterRestClient and @RestClient

i proposed that they are @RegisterDaprInvokeClient and @DaprInvokeClient,such as

@Path("/dapr-invoke-client")
@RegisterDaprInvokeClient
public interface ExtensionsService {

    @GET
    String getById(@QueryParam String id);

}

@ApplicationScoped
public class DaprRestClient2ExtensionResource {

    @DaprInvokeClient
    ExtensionsService extensionsService;

}

@zhfeng
Copy link
Contributor Author

zhfeng commented Apr 20, 2022

Why it needs @Path here ? is it refer to javax.ws.rs.Path?

The dapr-client does the http invokings like JaxRS style? @aosky can you provide a typical example of dapr http usage?

@naah69
Copy link
Contributor

naah69 commented Apr 20, 2022

dapr invoke is a kind of rpc,so it need @Path.
below is method of dapr client ,it is too original,we need package it such as quarkus-rest-client

    public <T> T invokeMethod(String appId, String methodName, Object data, HttpExtension httpExtension,
            Map<String, String> metadata, TypeRef<T> type) {
        return daprClient.invokeMethod(appId, methodName, data, httpExtension, metadata, type).block();
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants