Package io.dapr.client
Class DaprClientHttp
java.lang.Object
io.dapr.client.DaprClientHttp
- All Implemented Interfaces:
DaprClient,java.io.Closeable,java.lang.AutoCloseable
public class DaprClientHttp extends java.lang.Object implements DaprClient
An adapter for the HTTP Client.
- See Also:
DaprHttp,DaprClient
-
Method Summary
Modifier and Type Method Description voidclose()reactor.core.publisher.Mono<java.lang.Void>deleteState(java.lang.String stateStoreName, java.lang.String key)Delete a state.reactor.core.publisher.Mono<java.lang.Void>deleteState(java.lang.String stateStoreName, java.lang.String key, java.lang.String etag, StateOptions options)Delete a state.reactor.core.publisher.Mono<java.util.Map<java.lang.String,java.lang.String>>getSecret(java.lang.String secretStoreName, java.lang.String secretName)Fetches a secret from the configured vault.reactor.core.publisher.Mono<java.util.Map<java.lang.String,java.lang.String>>getSecret(java.lang.String secretStoreName, java.lang.String secretName, java.util.Map<java.lang.String,java.lang.String> metadata)Fetches a secret from the configured vault.<T> reactor.core.publisher.Mono<State<T>>getState(java.lang.String stateStoreName, State<T> state, TypeRef<T> type)Retrieve a State based on their key.<T> reactor.core.publisher.Mono<State<T>>getState(java.lang.String stateStoreName, State<T> state, java.lang.Class<T> clazz)Retrieve a State based on their key.<T> reactor.core.publisher.Mono<State<T>>getState(java.lang.String stateStoreName, java.lang.String key, TypeRef<T> type)Retrieve a State based on their key.<T> reactor.core.publisher.Mono<State<T>>getState(java.lang.String stateStoreName, java.lang.String key, java.lang.Class<T> clazz)Retrieve a State based on their key.<T> reactor.core.publisher.Mono<State<T>>getState(java.lang.String stateStoreName, java.lang.String key, java.lang.String etag, StateOptions options, TypeRef<T> type)Retrieve a State based on their key.<T> reactor.core.publisher.Mono<State<T>>getState(java.lang.String stateStoreName, java.lang.String key, java.lang.String etag, StateOptions options, java.lang.Class<T> clazz)Retrieve a State based on their key.reactor.core.publisher.Mono<byte[]>invokeBinding(java.lang.String name, java.lang.String operation, byte[] data, java.util.Map<java.lang.String,java.lang.String> metadata)Invokes a Binding operation, skipping serialization.reactor.core.publisher.Mono<java.lang.Void>invokeBinding(java.lang.String name, java.lang.String operation, java.lang.Object data)Invokes a Binding operation.<T> reactor.core.publisher.Mono<T>invokeBinding(java.lang.String name, java.lang.String operation, java.lang.Object data, TypeRef<T> type)Invokes a Binding operation.<T> reactor.core.publisher.Mono<T>invokeBinding(java.lang.String name, java.lang.String operation, java.lang.Object data, java.lang.Class<T> clazz)Invokes a Binding operation.<T> reactor.core.publisher.Mono<T>invokeBinding(java.lang.String name, java.lang.String operation, java.lang.Object data, java.util.Map<java.lang.String,java.lang.String> metadata, TypeRef<T> type)Invokes a Binding operation.<T> reactor.core.publisher.Mono<T>invokeBinding(java.lang.String name, java.lang.String operation, java.lang.Object data, java.util.Map<java.lang.String,java.lang.String> metadata, java.lang.Class<T> clazz)Invokes a Binding operation.reactor.core.publisher.Mono<byte[]>invokeService(java.lang.String appId, java.lang.String method, byte[] request, HttpExtension httpExtension, java.util.Map<java.lang.String,java.lang.String> metadata)Invoke a service with all possible parameters, using serialization.reactor.core.publisher.Mono<java.lang.Void>invokeService(java.lang.String appId, java.lang.String method, HttpExtension httpExtension, java.util.Map<java.lang.String,java.lang.String> metadata)Invoke a service with all possible parameters, using serialization.<T> reactor.core.publisher.Mono<T>invokeService(java.lang.String appId, java.lang.String method, HttpExtension httpExtension, java.util.Map<java.lang.String,java.lang.String> metadata, TypeRef<T> type)Invoke a service with all possible parameters, using serialization.<T> reactor.core.publisher.Mono<T>invokeService(java.lang.String appId, java.lang.String method, HttpExtension httpExtension, java.util.Map<java.lang.String,java.lang.String> metadata, java.lang.Class<T> clazz)Invoke a service with all possible parameters, using serialization.reactor.core.publisher.Mono<java.lang.Void>invokeService(java.lang.String appId, java.lang.String method, java.lang.Object request, HttpExtension httpExtension)Invoke a service with all possible parameters, using serialization.<T> reactor.core.publisher.Mono<T>invokeService(java.lang.String appId, java.lang.String method, java.lang.Object request, HttpExtension httpExtension, TypeRef<T> type)Invoke a service with all possible parameters, using serialization.<T> reactor.core.publisher.Mono<T>invokeService(java.lang.String appId, java.lang.String method, java.lang.Object request, HttpExtension httpExtension, java.lang.Class<T> clazz)Invoke a service with all possible parameters, using serialization.reactor.core.publisher.Mono<java.lang.Void>invokeService(java.lang.String appId, java.lang.String method, java.lang.Object request, HttpExtension httpExtension, java.util.Map<java.lang.String,java.lang.String> metadata)Invoke a service with all possible parameters, using serialization.<T> reactor.core.publisher.Mono<T>invokeService(java.lang.String appId, java.lang.String method, java.lang.Object request, HttpExtension httpExtension, java.util.Map<java.lang.String,java.lang.String> metadata, TypeRef<T> type)Invoke a service with all possible parameters, using serialization.<T> reactor.core.publisher.Mono<T>invokeService(java.lang.String appId, java.lang.String method, java.lang.Object request, HttpExtension httpExtension, java.util.Map<java.lang.String,java.lang.String> metadata, java.lang.Class<T> clazz)Invoke a service with all possible parameters, using serialization.reactor.core.publisher.Mono<java.lang.Void>publishEvent(java.lang.String pubsubName, java.lang.String topic, java.lang.Object data)Publish an event.reactor.core.publisher.Mono<java.lang.Void>publishEvent(java.lang.String pubsubName, java.lang.String topic, java.lang.Object data, java.util.Map<java.lang.String,java.lang.String> metadata)Publish an event.reactor.core.publisher.Mono<java.lang.Void>saveState(java.lang.String stateStoreName, java.lang.String key, java.lang.Object value)Save/Update a state.reactor.core.publisher.Mono<java.lang.Void>saveState(java.lang.String stateStoreName, java.lang.String key, java.lang.String etag, java.lang.Object value, StateOptions options)Save/Update a state.reactor.core.publisher.Mono<java.lang.Void>saveStates(java.lang.String stateStoreName, java.util.List<State<?>> states)Save/Update a list of states.
-
Method Details
-
publishEvent
public reactor.core.publisher.Mono<java.lang.Void> publishEvent(java.lang.String pubsubName, java.lang.String topic, java.lang.Object data)Publish an event.- Specified by:
publishEventin interfaceDaprClient- Parameters:
pubsubName- the pubsub name we will publish the event totopic- the topic where the event will be published.data- the event's data to be published, use byte[] for skipping serialization.- Returns:
- a Mono plan of type Void.
-
publishEvent
public reactor.core.publisher.Mono<java.lang.Void> publishEvent(java.lang.String pubsubName, java.lang.String topic, java.lang.Object data, java.util.Map<java.lang.String,java.lang.String> metadata)Publish an event.- Specified by:
publishEventin interfaceDaprClient- Parameters:
pubsubName- the pubsub name we will publish the event totopic- the topic where the event will be published.data- the event's data to be published, use byte[] for skipping serialization.metadata- The metadata for the published event.- Returns:
- a Mono plan of type Void.
-
invokeService
public <T> reactor.core.publisher.Mono<T> invokeService(java.lang.String appId, java.lang.String method, java.lang.Object request, HttpExtension httpExtension, java.util.Map<java.lang.String,java.lang.String> metadata, TypeRef<T> type)Invoke a service with all possible parameters, using serialization.- Specified by:
invokeServicein interfaceDaprClient- Type Parameters:
T- The Type of the return, use byte[] to skip serialization.- Parameters:
appId- The Application ID where the service is.method- The actual Method to be call in the application.request- The request to be sent to invoke the service, use byte[] to skip serialization.httpExtension- Additional fields that are needed if the receiving app is listening on HTTP,HttpExtension.NONEotherwise.metadata- Metadata (in GRPC) or headers (in HTTP) to be sent in request.type- The Type needed as return for the call.- Returns:
- A Mono Plan of type type.
-
invokeService
public <T> reactor.core.publisher.Mono<T> invokeService(java.lang.String appId, java.lang.String method, java.lang.Object request, HttpExtension httpExtension, java.util.Map<java.lang.String,java.lang.String> metadata, java.lang.Class<T> clazz)Invoke a service with all possible parameters, using serialization.- Specified by:
invokeServicein interfaceDaprClient- Type Parameters:
T- The Type of the return, use byte[] to skip serialization.- Parameters:
appId- The Application ID where the service is.method- The actual Method to be call in the application.request- The request to be sent to invoke the service, use byte[] to skip serialization.httpExtension- Additional fields that are needed if the receiving app is listening on HTTP,HttpExtension.NONEotherwise.metadata- Metadata (in GRPC) or headers (in HTTP) to be sent in request.clazz- The type needed as return for the call.- Returns:
- A Mono Plan of type type.
-
invokeService
public <T> reactor.core.publisher.Mono<T> invokeService(java.lang.String appId, java.lang.String method, HttpExtension httpExtension, java.util.Map<java.lang.String,java.lang.String> metadata, TypeRef<T> type)Invoke a service with all possible parameters, using serialization.- Specified by:
invokeServicein interfaceDaprClient- Type Parameters:
T- The Type of the return, use byte[] to skip serialization.- Parameters:
appId- The Application ID where the service is.method- The actual Method to be call in the application.httpExtension- Additional fields that are needed if the receiving app is listening on HTTP,HttpExtension.NONEotherwise.metadata- Metadata (in GRPC) or headers (in HTTP) to be sent in request.type- The Type needed as return for the call.- Returns:
- A Mono Plan of type type.
-
invokeService
public <T> reactor.core.publisher.Mono<T> invokeService(java.lang.String appId, java.lang.String method, HttpExtension httpExtension, java.util.Map<java.lang.String,java.lang.String> metadata, java.lang.Class<T> clazz)Invoke a service with all possible parameters, using serialization.- Specified by:
invokeServicein interfaceDaprClient- Type Parameters:
T- The Type of the return, use byte[] to skip serialization.- Parameters:
appId- The Application ID where the service is.method- The actual Method to be call in the application.httpExtension- Additional fields that are needed if the receiving app is listening on HTTP,HttpExtension.NONEotherwise.metadata- Metadata (in GRPC) or headers (in HTTP) to be sent in request.clazz- The type needed as return for the call.- Returns:
- A Mono Plan of type type.
-
invokeService
public <T> reactor.core.publisher.Mono<T> invokeService(java.lang.String appId, java.lang.String method, java.lang.Object request, HttpExtension httpExtension, TypeRef<T> type)Invoke a service with all possible parameters, using serialization.- Specified by:
invokeServicein interfaceDaprClient- Type Parameters:
T- The Type of the return, use byte[] to skip serialization.- Parameters:
appId- The Application ID where the service is.method- The actual Method to be call in the application.request- The request to be sent to invoke the service, use byte[] to skip serialization.httpExtension- Additional fields that are needed if the receiving app is listening on HTTP,HttpExtension.NONEotherwise.type- The Type needed as return for the call.- Returns:
- A Mono Plan of type type.
-
invokeService
public <T> reactor.core.publisher.Mono<T> invokeService(java.lang.String appId, java.lang.String method, java.lang.Object request, HttpExtension httpExtension, java.lang.Class<T> clazz)Invoke a service with all possible parameters, using serialization.- Specified by:
invokeServicein interfaceDaprClient- Type Parameters:
T- The Type of the return, use byte[] to skip serialization.- Parameters:
appId- The Application ID where the service is.method- The actual Method to be call in the application.request- The request to be sent to invoke the service, use byte[] to skip serialization.httpExtension- Additional fields that are needed if the receiving app is listening on HTTP,HttpExtension.NONEotherwise.clazz- The type needed as return for the call.- Returns:
- A Mono Plan of type type.
-
invokeService
public reactor.core.publisher.Mono<java.lang.Void> invokeService(java.lang.String appId, java.lang.String method, java.lang.Object request, HttpExtension httpExtension)Invoke a service with all possible parameters, using serialization.- Specified by:
invokeServicein interfaceDaprClient- Parameters:
appId- The Application ID where the service is.method- The actual Method to be call in the application.request- The request to be sent to invoke the service, use byte[] to skip serialization.httpExtension- Additional fields that are needed if the receiving app is listening on HTTP,HttpExtension.NONEotherwise.- Returns:
- A Mono Plan of type type.
-
invokeService
public reactor.core.publisher.Mono<java.lang.Void> invokeService(java.lang.String appId, java.lang.String method, java.lang.Object request, HttpExtension httpExtension, java.util.Map<java.lang.String,java.lang.String> metadata)Invoke a service with all possible parameters, using serialization.- Specified by:
invokeServicein interfaceDaprClient- Parameters:
appId- The Application ID where the service is.method- The actual Method to be call in the application.request- The request to be sent to invoke the service, use byte[] to skip serialization.httpExtension- Additional fields that are needed if the receiving app is listening on HTTP,HttpExtension.NONEotherwise.metadata- Metadata (in GRPC) or headers (in HTTP) to be sent in request.- Returns:
- A Mono Plan of type type.
-
invokeService
public reactor.core.publisher.Mono<java.lang.Void> invokeService(java.lang.String appId, java.lang.String method, HttpExtension httpExtension, java.util.Map<java.lang.String,java.lang.String> metadata)Invoke a service with all possible parameters, using serialization.- Specified by:
invokeServicein interfaceDaprClient- Parameters:
appId- The Application ID where the service is.method- The actual Method to be call in the application.httpExtension- Additional fields that are needed if the receiving app is listening on HTTP,HttpExtension.NONEotherwise.metadata- Metadata (in GRPC) or headers (in HTTP) to be sent in request.- Returns:
- A Mono Plan of type type.
-
invokeService
public reactor.core.publisher.Mono<byte[]> invokeService(java.lang.String appId, java.lang.String method, byte[] request, HttpExtension httpExtension, java.util.Map<java.lang.String,java.lang.String> metadata)Invoke a service with all possible parameters, using serialization.- Specified by:
invokeServicein interfaceDaprClient- Parameters:
appId- The Application ID where the service is.method- The actual Method to be call in the application.request- The request to be sent to invoke the service, use byte[] to skip serialization.httpExtension- Additional fields that are needed if the receiving app is listening on HTTP,HttpExtension.NONEotherwise.metadata- Metadata (in GRPC) or headers (in HTTP) to be sent in request.- Returns:
- A Mono Plan of type type.
-
invokeBinding
public reactor.core.publisher.Mono<java.lang.Void> invokeBinding(java.lang.String name, java.lang.String operation, java.lang.Object data)Invokes a Binding operation.- Specified by:
invokeBindingin interfaceDaprClient- Parameters:
name- The name of the biding to call.operation- The operation to be performed by the binding request processor.data- The data to be processed, use byte[] to skip serialization.- Returns:
- an empty Mono.
-
invokeBinding
public reactor.core.publisher.Mono<byte[]> invokeBinding(java.lang.String name, java.lang.String operation, byte[] data, java.util.Map<java.lang.String,java.lang.String> metadata)Invokes a Binding operation, skipping serialization.- Specified by:
invokeBindingin interfaceDaprClient- Parameters:
name- The name of the biding to call.operation- The operation to be performed by the binding request processor.data- The data to be processed, skipping serialization.metadata- The metadata map.- Returns:
- a Mono plan of type byte[].
-
invokeBinding
public <T> reactor.core.publisher.Mono<T> invokeBinding(java.lang.String name, java.lang.String operation, java.lang.Object data, TypeRef<T> type)Invokes a Binding operation.- Specified by:
invokeBindingin interfaceDaprClient- Type Parameters:
T- The type of the return- Parameters:
name- The name of the biding to call.operation- The operation to be performed by the binding request processor.data- The data to be processed, use byte[] to skip serialization.type- The type being returned.- Returns:
- a Mono plan of type T.
-
invokeBinding
public <T> reactor.core.publisher.Mono<T> invokeBinding(java.lang.String name, java.lang.String operation, java.lang.Object data, java.lang.Class<T> clazz)Invokes a Binding operation.- Specified by:
invokeBindingin interfaceDaprClient- Type Parameters:
T- The type of the return- Parameters:
name- The name of the biding to call.operation- The operation to be performed by the binding request processor.data- The data to be processed, use byte[] to skip serialization.clazz- The type being returned.- Returns:
- a Mono plan of type T.
-
invokeBinding
public <T> reactor.core.publisher.Mono<T> invokeBinding(java.lang.String name, java.lang.String operation, java.lang.Object data, java.util.Map<java.lang.String,java.lang.String> metadata, TypeRef<T> type)Invokes a Binding operation.- Specified by:
invokeBindingin interfaceDaprClient- Type Parameters:
T- The type of the return- Parameters:
name- The name of the biding to call.operation- The operation to be performed by the binding request processor.data- The data to be processed, use byte[] to skip serialization.metadata- The metadata map.type- The type being returned.- Returns:
- a Mono plan of type T.
-
invokeBinding
public <T> reactor.core.publisher.Mono<T> invokeBinding(java.lang.String name, java.lang.String operation, java.lang.Object data, java.util.Map<java.lang.String,java.lang.String> metadata, java.lang.Class<T> clazz)Invokes a Binding operation.- Specified by:
invokeBindingin interfaceDaprClient- Type Parameters:
T- The type of the return- Parameters:
name- The name of the biding to call.operation- The operation to be performed by the binding request processor.data- The data to be processed, use byte[] to skip serialization.metadata- The metadata map.clazz- The type being returned.- Returns:
- a Mono plan of type T.
-
getState
public <T> reactor.core.publisher.Mono<State<T>> getState(java.lang.String stateStoreName, State<T> state, TypeRef<T> type)Retrieve a State based on their key.- Specified by:
getStatein interfaceDaprClient- Type Parameters:
T- The type of the return.- Parameters:
stateStoreName- The name of the state store.state- State to be re-retrieved.type- The type of State needed as return.- Returns:
- A Mono Plan for the requested State.
-
getState
public <T> reactor.core.publisher.Mono<State<T>> getState(java.lang.String stateStoreName, State<T> state, java.lang.Class<T> clazz)Retrieve a State based on their key.- Specified by:
getStatein interfaceDaprClient- Type Parameters:
T- The type of the return.- Parameters:
stateStoreName- The name of the state store.state- State to be re-retrieved.clazz- The type of State needed as return.- Returns:
- A Mono Plan for the requested State.
-
getState
public <T> reactor.core.publisher.Mono<State<T>> getState(java.lang.String stateStoreName, java.lang.String key, TypeRef<T> type)Retrieve a State based on their key.- Specified by:
getStatein interfaceDaprClient- Type Parameters:
T- The type of the return.- Parameters:
stateStoreName- The name of the state store.key- The key of the State to be retrieved.type- The type of State needed as return.- Returns:
- A Mono Plan for the requested State.
-
getState
public <T> reactor.core.publisher.Mono<State<T>> getState(java.lang.String stateStoreName, java.lang.String key, java.lang.Class<T> clazz)Retrieve a State based on their key.- Specified by:
getStatein interfaceDaprClient- Type Parameters:
T- The type of the return.- Parameters:
stateStoreName- The name of the state store.key- The key of the State to be retrieved.clazz- The type of State needed as return.- Returns:
- A Mono Plan for the requested State.
-
getState
public <T> reactor.core.publisher.Mono<State<T>> getState(java.lang.String stateStoreName, java.lang.String key, java.lang.String etag, StateOptions options, TypeRef<T> type)Retrieve a State based on their key.- Specified by:
getStatein interfaceDaprClient- Type Parameters:
T- The Type of the return.- Parameters:
stateStoreName- The name of the state store.key- The key of the State to be retrieved.etag- Optional etag for conditional getoptions- Optional settings for retrieve operation.type- The Type of State needed as return.- Returns:
- A Mono Plan for the requested State.
-
getState
public <T> reactor.core.publisher.Mono<State<T>> getState(java.lang.String stateStoreName, java.lang.String key, java.lang.String etag, StateOptions options, java.lang.Class<T> clazz)Description copied from interface:DaprClientRetrieve a State based on their key.- Specified by:
getStatein interfaceDaprClient- Type Parameters:
T- The type of the return.- Parameters:
stateStoreName- The name of the state store.key- The key of the State to be retrieved.etag- Optional etag for conditional getoptions- Optional settings for retrieve operation.clazz- The type of State needed as return.- Returns:
- A Mono Plan for the requested State.
-
saveStates
public reactor.core.publisher.Mono<java.lang.Void> saveStates(java.lang.String stateStoreName, java.util.List<State<?>> states)Save/Update a list of states.- Specified by:
saveStatesin interfaceDaprClient- Parameters:
stateStoreName- The name of the state store.states- The States to be saved.- Returns:
- a Mono plan of type Void.
-
saveState
public reactor.core.publisher.Mono<java.lang.Void> saveState(java.lang.String stateStoreName, java.lang.String key, java.lang.Object value)Save/Update a state.- Specified by:
saveStatein interfaceDaprClient- Parameters:
stateStoreName- The name of the state store.key- The key of the state.value- The value of the state.- Returns:
- a Mono plan of type Void.
-
saveState
public reactor.core.publisher.Mono<java.lang.Void> saveState(java.lang.String stateStoreName, java.lang.String key, java.lang.String etag, java.lang.Object value, StateOptions options)Save/Update a state.- Specified by:
saveStatein interfaceDaprClient- Parameters:
stateStoreName- The name of the state store.key- The key of the state.etag- The etag to be used.value- The value of the state.options- The Options to use for each state.- Returns:
- a Mono plan of type Void.
-
deleteState
public reactor.core.publisher.Mono<java.lang.Void> deleteState(java.lang.String stateStoreName, java.lang.String key)Delete a state.- Specified by:
deleteStatein interfaceDaprClient- Parameters:
stateStoreName- The name of the state store.key- The key of the State to be removed.- Returns:
- a Mono plan of type Void.
-
deleteState
public reactor.core.publisher.Mono<java.lang.Void> deleteState(java.lang.String stateStoreName, java.lang.String key, java.lang.String etag, StateOptions options)Delete a state.- Specified by:
deleteStatein interfaceDaprClient- Parameters:
stateStoreName- The name of the state store.key- The key of the State to be removed.etag- Optional etag for conditional delete.options- Optional settings for state operation.- Returns:
- a Mono plan of type Void.
-
getSecret
public reactor.core.publisher.Mono<java.util.Map<java.lang.String,java.lang.String>> getSecret(java.lang.String secretStoreName, java.lang.String secretName, java.util.Map<java.lang.String,java.lang.String> metadata)Fetches a secret from the configured vault.- Specified by:
getSecretin interfaceDaprClient- Parameters:
secretStoreName- Name of vault component in Dapr.secretName- Secret to be fetched.metadata- Optional metadata.- Returns:
- Key-value pairs for the secret.
-
getSecret
public reactor.core.publisher.Mono<java.util.Map<java.lang.String,java.lang.String>> getSecret(java.lang.String secretStoreName, java.lang.String secretName)Fetches a secret from the configured vault.- Specified by:
getSecretin interfaceDaprClient- Parameters:
secretStoreName- Name of vault component in Dapr.secretName- Secret to be fetched.- Returns:
- Key-value pairs for the secret.
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-