quarkus-dapr
quarkus-dapr copied to clipboard
Introduce to inject DaprClient in the interfaces
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.
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;
}
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?
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();
}