Class DaprClientImpl

java.lang.Object
io.dapr.client.DaprClientImpl
All Implemented Interfaces:
DaprClient, DaprPreviewClient, AutoCloseable

public class DaprClientImpl extends Object
Implementation of the Dapr client combining gRPC and HTTP (when applicable).
See Also:
  • Field Details

    • JSON_REQUEST_MAPPER

      protected static final com.fasterxml.jackson.databind.ObjectMapper JSON_REQUEST_MAPPER
      A mapper to serialize JSON request objects.
    • objectSerializer

      protected DaprObjectSerializer objectSerializer
      A utility class for serialize and deserialize the transient objects.
    • stateSerializer

      protected DaprObjectSerializer stateSerializer
      A utility class for serialize and deserialize state objects.
  • Method Details

    • newGrpcStub

      public <T extends io.grpc.stub.AbstractStub<T>> T newGrpcStub(String appId, Function<io.grpc.Channel,T> stubBuilder)
      Returns a newly created gRPC stub with proper interceptors and channel for gRPC proxy invocation.
      Type Parameters:
      T - the generic type of the service to be invoked.
      Parameters:
      appId - appId to be included in all gRPC calls for service invocation.
      stubBuilder - user-provided callback method to construct a new stub given the channel.
      Returns:
      the gRPC stub with proper interceptors and channel.
    • waitForSidecar

      public reactor.core.publisher.Mono<Void> waitForSidecar(int timeoutInMilliseconds)
      Waits for the sidecar, giving up after timeout.
      Parameters:
      timeoutInMilliseconds - Timeout in milliseconds to wait for sidecar.
      Returns:
      a Mono plan of type Void.
    • healthCheck

      public reactor.core.publisher.Mono<Boolean> healthCheck()
      Checks the health of the sidecar by calling the /v1.0/healthz endpoint.

      Unlike DaprClient.waitForSidecar(int), which relies on /v1.0/healthz/outbound, this check only succeeds once all components are initialized, the Dapr HTTP port is available and the app channel is established. Calling it while the app is still starting up may therefore return false.

      Returns:
      a Mono emitting true if the sidecar is healthy, false otherwise.
    • publishEvent

      public reactor.core.publisher.Mono<Void> publishEvent(PublishEventRequest request)
      Publish an event.
      Parameters:
      request - the request for the publish event.
      Returns:
      a Mono plan of a Dapr's void response.
    • publishEvents

      public <T> reactor.core.publisher.Mono<BulkPublishResponse<T>> publishEvents(BulkPublishRequest<T> request)
      Publish multiple events to Dapr in a single request.
      Type Parameters:
      T - The type of events to publish in the call.
      Parameters:
      request - BulkPublishRequest object.
      Returns:
      A Mono of BulkPublishResponse object.
    • subscribeToEvents

      public <T> Subscription subscribeToEvents(String pubsubName, String topic, SubscriptionListener<T> listener, TypeRef<T> type)
      Subscribe to pubsub via streaming.
      Type Parameters:
      T - Type of object deserialization.
      Parameters:
      pubsubName - Name of the pubsub component.
      topic - Name of the topic to subscribe to.
      listener - Callback methods to process events.
      type - Type for object deserialization.
      Returns:
      An active subscription.
    • subscribeToEvents

      public <T> Subscription subscribeToEvents(String pubsubName, String topic, String deadLetterTopic, SubscriptionListener<T> listener, TypeRef<T> type)
      Subscribe to pubsub via streaming with a dead-letter topic.
      Type Parameters:
      T - Type of object deserialization.
      Parameters:
      pubsubName - Name of the pubsub component.
      topic - Name of the topic to subscribe to.
      deadLetterTopic - Name of the dead-letter topic to forward failed messages to (null or empty to disable).
      listener - Callback methods to process events.
      type - Type for object deserialization.
      Returns:
      An active subscription.
    • subscribeToEvents

      @Deprecated public <T> reactor.core.publisher.Flux<T> subscribeToEvents(String pubsubName, String topic, TypeRef<T> type)
      Deprecated.
      Subscribe to pubsub events via streaming using Project Reactor Flux.
      Type Parameters:
      T - Type of the event payload.
      Parameters:
      pubsubName - Name of the pubsub component.
      topic - Name of the topic to subscribe to.
      type - Type for object deserialization.
      Returns:
      A Flux of deserialized event payloads.
    • subscribeToEvents

      @Deprecated public <T> reactor.core.publisher.Flux<T> subscribeToEvents(String pubsubName, String topic, TypeRef<T> type, Map<String,String> metadata)
      Deprecated.
      Subscribe to pubsub events via streaming using Project Reactor Flux with metadata support.
      Type Parameters:
      T - Type of the event payload.
      Parameters:
      pubsubName - Name of the pubsub component.
      topic - Name of the topic to subscribe to.
      type - Type for object deserialization.
      metadata - Subscription metadata (e.g., {"rawPayload": "true"}).
      Returns:
      A Flux of deserialized event payloads.
    • subscribeToTopic

      public <T> reactor.core.publisher.Flux<T> subscribeToTopic(String pubsubName, String topic, TypeRef<T> type)
      Subscribe to pubsub events via streaming using Project Reactor Flux.

      The type parameter determines what is deserialized from the event data:

      • Use TypeRef.STRING or similar for raw payload data
      • Use new TypeRef<CloudEvent<String>>(){} to receive CloudEvent with metadata
      Type Parameters:
      T - Type of the event payload.
      Parameters:
      pubsubName - Name of the pubsub component.
      topic - Name of the topic to subscribe to.
      type - Type for object deserialization.
      Returns:
      A Flux of deserialized event payloads.
    • subscribeToTopic

      public <T> reactor.core.publisher.Flux<T> subscribeToTopic(String pubsubName, String topic, TypeRef<T> type, Map<String,String> metadata)
      Subscribe to pubsub events via streaming using Project Reactor Flux with metadata support.

      If metadata is null or empty, this method delegates to DaprPreviewClient.subscribeToTopic(String, String, TypeRef). Use metadata {"rawPayload": "true"} for raw payload subscriptions where Dapr delivers messages without CloudEvent wrapping.

      Type Parameters:
      T - Type of the event payload.
      Parameters:
      pubsubName - Name of the pubsub component.
      topic - Name of the topic to subscribe to.
      type - Type for object deserialization.
      metadata - Subscription metadata (e.g., {"rawPayload": "true"}).
      Returns:
      A Flux of deserialized event payloads.
    • subscribeToTopic

      public <T> reactor.core.publisher.Flux<T> subscribeToTopic(String pubsubName, String topic, String deadLetterTopic, TypeRef<T> type)
      Subscribe to pubsub events via streaming using Project Reactor Flux with a dead-letter topic.
      Type Parameters:
      T - Type of the event payload.
      Parameters:
      pubsubName - Name of the pubsub component.
      topic - Name of the topic to subscribe to.
      deadLetterTopic - Name of the dead-letter topic to forward failed messages to (null or empty to disable).
      type - Type for object deserialization.
      Returns:
      A Flux of deserialized event payloads.
    • subscribeToTopic

      public <T> reactor.core.publisher.Flux<T> subscribeToTopic(String pubsubName, String topic, String deadLetterTopic, TypeRef<T> type, Map<String,String> metadata)
      Subscribe to pubsub events via streaming using Project Reactor Flux with metadata and dead-letter topic.
      Type Parameters:
      T - Type of the event payload.
      Parameters:
      pubsubName - Name of the pubsub component.
      topic - Name of the topic to subscribe to.
      deadLetterTopic - Name of the dead-letter topic to forward failed messages to (null or empty to disable).
      type - Type for object deserialization.
      metadata - Subscription metadata (e.g., {"rawPayload": "true"}).
      Returns:
      A Flux of deserialized event payloads.
    • invokeMethod

      @Deprecated public <T> reactor.core.publisher.Mono<T> invokeMethod(InvokeMethodRequest invokeMethodRequest, TypeRef<T> type)
      Deprecated.
      Description copied from interface: DaprClient
      Invoke a service method.
      Type Parameters:
      T - The Type of the return, use byte[] to skip serialization.
      Parameters:
      invokeMethodRequest - Request object.
      type - The Type needed as return for the call.
      Returns:
      A Mono Plan of type T.
    • invokeHttpClient

      public DaprInvokeHttpClient invokeHttpClient(String appId)
      Description copied from interface: DaprClient
      Creates an HTTP client pre-configured for Dapr service invocation against the given app id.

      The returned client resolves relative paths against {daprHttpEndpoint}/v1.0/invoke/{appId}/method/ and automatically attaches the dapr-api-token header when one is configured. It reuses the SDK's shared HttpClient instance.

      Migrating from invokeMethod: the deprecated invokeMethod APIs serialized request bodies through the configured DaprObjectSerializer (JSON by default), so a String payload was sent as a JSON string literal (e.g. "hello"). This client does not serialize bodies — callers supply raw BodyPublishers exactly as with any HttpClient. To preserve the previous JSON encoding, use DaprBodyPublishers.json(Object).

      Parameters:
      appId - the application id to invoke.
      Returns:
      a DaprInvokeHttpClient bound to appId.
    • invokeBinding

      public <T> reactor.core.publisher.Mono<T> invokeBinding(InvokeBindingRequest request, TypeRef<T> type)
      Invokes a Binding operation.
      Type Parameters:
      T - The type of the return
      Parameters:
      request - The binding invocation request.
      type - The type being returned.
      Returns:
      a Mono plan of type T.
    • getState

      public <T> reactor.core.publisher.Mono<State<T>> getState(GetStateRequest request, TypeRef<T> type)
      Retrieve a State based on their key.
      Type Parameters:
      T - The Type of the return.
      Parameters:
      request - The request to get state.
      type - The Type of State needed as return.
      Returns:
      A Mono Plan for the requested State.
    • getBulkState

      public <T> reactor.core.publisher.Mono<List<State<T>>> getBulkState(GetBulkStateRequest request, TypeRef<T> type)
      Retrieve bulk States based on their keys.
      Type Parameters:
      T - The Type of the return.
      Parameters:
      request - The request to get state.
      type - The Type of State needed as return.
      Returns:
      A Mono Plan for the requested State.
    • executeStateTransaction

      public reactor.core.publisher.Mono<Void> executeStateTransaction(ExecuteStateTransactionRequest request)
      Execute a transaction.
      Parameters:
      request - Request to execute transaction.
      Returns:
      a Mono plan of type Response Void
    • saveBulkState

      public reactor.core.publisher.Mono<Void> saveBulkState(SaveStateRequest request)
      Save/Update a list of states.
      Parameters:
      request - Request to save states.
      Returns:
      a Mono plan of type Void.
    • deleteState

      public reactor.core.publisher.Mono<Void> deleteState(DeleteStateRequest request)
      Delete a state.
      Parameters:
      request - Request to delete a state.
      Returns:
      a Mono plan of type Void.
    • getSecret

      public reactor.core.publisher.Mono<Map<String,String>> getSecret(GetSecretRequest request)
      Fetches a secret from the configured vault.
      Parameters:
      request - Request to fetch secret.
      Returns:
      Key-value pairs for the secret.
    • getBulkSecret

      public reactor.core.publisher.Mono<Map<String,Map<String,String>>> getBulkSecret(GetBulkSecretRequest request)
      Fetches all secrets from the configured vault.
      Parameters:
      request - Request to fetch secret.
      Returns:
      Key-value pairs for the secret.
    • tryLock

      public reactor.core.publisher.Mono<Boolean> tryLock(LockRequest request)
      Tries to get a lock with an expiry.
      Parameters:
      request - The request to lock
      Returns:
      Whether the lock is successful
    • unlock

      public reactor.core.publisher.Mono<UnlockResponseStatus> unlock(UnlockRequest request)
      Unlocks a lock.
      Parameters:
      request - The request to unlock
      Returns:
      Unlock result
    • queryState

      public <T> reactor.core.publisher.Mono<QueryStateResponse<T>> queryState(QueryStateRequest request, TypeRef<T> type)
      Query for states using a query request.
      Type Parameters:
      T - The Type of the return, use byte[] to skip serialization.
      Parameters:
      request - Query request object.
      type - The type needed as return for the call.
      Returns:
      A Mono of QueryStateResponse of type T.
    • close

      public void close() throws Exception
      Closes the ManagedChannel for GRPC.
      Throws:
      IOException - on exception.
      Exception
      See Also:
      • ManagedChannel.shutdown()
    • shutdown

      public reactor.core.publisher.Mono<Void> shutdown()
      Gracefully shutdown the dapr runtime.
      Returns:
      a Mono plan of type Void.
    • getConfiguration

      public reactor.core.publisher.Mono<Map<String,ConfigurationItem>> getConfiguration(GetConfigurationRequest request)
      Retrieve Map of configurations based on a provided configuration request object.
      Parameters:
      request - request for retrieving Configurations for a list keys
      Returns:
      Mono of Map of ConfigurationItems
    • subscribeConfiguration

      public reactor.core.publisher.Flux<SubscribeConfigurationResponse> subscribeConfiguration(SubscribeConfigurationRequest request)
      Subscribe to the keys for any change.
      Parameters:
      request - request for subscribing to any change for the given keys in request
      Returns:
      Flux of SubscribeConfigurationResponse instance
    • unsubscribeConfiguration

      public reactor.core.publisher.Mono<UnsubscribeConfigurationResponse> unsubscribeConfiguration(UnsubscribeConfigurationRequest request)
      Unsubscribe from previously subscribed keys.
      Parameters:
      request - request for unsubscribing to any change for the given subscription id in request
      Returns:
      Mono of UnsubscribeConfigurationResponse instance.
    • scheduleJob

      public reactor.core.publisher.Mono<Void> scheduleJob(ScheduleJobRequest scheduleJobRequest)
      Schedules a job using the provided job request details.
      Parameters:
      scheduleJobRequest - The request containing the details of the job to schedule. Must include a name and optional schedule, data, and other related properties.
      Returns:
      A Mono that completes when the job scheduling operation is successful or raises an error.
    • getJob

      public reactor.core.publisher.Mono<GetJobResponse> getJob(GetJobRequest getJobRequest)
      Retrieves details of a specific job.
      Parameters:
      getJobRequest - The request containing the job name for which the details are to be fetched. The name property is mandatory.
      Returns:
      A Mono that emits the GetJobResponse containing job details or raises an error if the job is not found.
    • deleteJob

      public reactor.core.publisher.Mono<Void> deleteJob(DeleteJobRequest deleteJobRequest)
      Deletes a job based on the given request.
      Parameters:
      deleteJobRequest - The request containing the job name to be deleted. The name property is mandatory.
      Returns:
      A Mono that completes when the job is successfully deleted or raises an error.
    • getMetadata

      public reactor.core.publisher.Mono<DaprMetadata> getMetadata()
      Description copied from interface: DaprClient
      Fetches Dapr Metadata from the metadata endpoint.
      Returns:
      DaprMetadata containing Dapr Metadata from the metadata endpoint.
    • converse

      @Deprecated(forRemoval=true) public reactor.core.publisher.Mono<ConversationResponse> converse(ConversationRequest conversationRequest)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • converseAlpha2

      public reactor.core.publisher.Mono<ConversationResponseAlpha2> converseAlpha2(ConversationRequestAlpha2 conversationRequestAlpha2)
    • encrypt

      public reactor.core.publisher.Flux<byte[]> encrypt(EncryptRequestAlpha1 request)
      Encrypt data using the Dapr cryptography building block. This method uses streaming to handle large payloads efficiently.
      Parameters:
      request - The encryption request containing component name, key information, and plaintext stream.
      Returns:
      A Flux of encrypted byte arrays (ciphertext chunks).
    • decrypt

      public reactor.core.publisher.Flux<byte[]> decrypt(DecryptRequestAlpha1 request)
      Decrypt data using the Dapr cryptography building block. This method uses streaming to handle large payloads efficiently.
      Parameters:
      request - The decryption request containing component name, optional key name, and ciphertext stream.
      Returns:
      A Flux of decrypted byte arrays (plaintext chunks).
    • publishEvent

      public reactor.core.publisher.Mono<Void> publishEvent(String pubsubName, String topicName, Object data)
      Publish an event.
      Specified by:
      publishEvent in interface DaprClient
      Parameters:
      pubsubName - the pubsub name we will publish the event to
      topicName - the topicName 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<Void> publishEvent(String pubsubName, String topicName, Object data, Map<String,String> metadata)
      Publish an event.
      Specified by:
      publishEvent in interface DaprClient
      Parameters:
      pubsubName - the pubsub name we will publish the event to
      topicName - the topicName 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.
    • invokeMethod

      @Deprecated public <T> reactor.core.publisher.Mono<T> invokeMethod(String appId, String methodName, Object data, HttpExtension httpExtension, Map<String,String> metadata, TypeRef<T> type)
      Deprecated.
      Invoke a service method, using serialization.
      Specified by:
      invokeMethod in interface DaprClient
      Type Parameters:
      T - The Type of the return, use byte[] to skip serialization.
      Parameters:
      appId - The Application ID where the service is.
      methodName - The actual Method to be call in the application.
      data - The data 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.NONE otherwise.
      metadata - Metadata (in GRPC) or headers (in HTTP) to be sent in data.
      type - The Type needed as return for the call.
      Returns:
      A Mono Plan of type T.
    • invokeMethod

      @Deprecated public <T> reactor.core.publisher.Mono<T> invokeMethod(String appId, String methodName, Object request, HttpExtension httpExtension, Map<String,String> metadata, Class<T> clazz)
      Deprecated.
      Invoke a service method, using serialization.
      Specified by:
      invokeMethod in interface DaprClient
      Type Parameters:
      T - The Type of the return, use byte[] to skip serialization.
      Parameters:
      appId - The Application ID where the service is.
      methodName - 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.NONE otherwise.
      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 T.
    • invokeMethod

      @Deprecated public <T> reactor.core.publisher.Mono<T> invokeMethod(String appId, String methodName, HttpExtension httpExtension, Map<String,String> metadata, TypeRef<T> type)
      Deprecated.
      Invoke a service method, using serialization.
      Specified by:
      invokeMethod in interface DaprClient
      Type Parameters:
      T - The Type of the return, use byte[] to skip serialization.
      Parameters:
      appId - The Application ID where the service is.
      methodName - The actual Method to be call in the application.
      httpExtension - Additional fields that are needed if the receiving app is listening on HTTP, HttpExtension.NONE otherwise.
      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 T.
    • invokeMethod

      @Deprecated public <T> reactor.core.publisher.Mono<T> invokeMethod(String appId, String methodName, HttpExtension httpExtension, Map<String,String> metadata, Class<T> clazz)
      Deprecated.
      Invoke a service method, using serialization.
      Specified by:
      invokeMethod in interface DaprClient
      Type Parameters:
      T - The Type of the return, use byte[] to skip serialization.
      Parameters:
      appId - The Application ID where the service is.
      methodName - The actual Method to be call in the application.
      httpExtension - Additional fields that are needed if the receiving app is listening on HTTP, HttpExtension.NONE otherwise.
      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 T.
    • invokeMethod

      @Deprecated public <T> reactor.core.publisher.Mono<T> invokeMethod(String appId, String methodName, Object request, HttpExtension httpExtension, TypeRef<T> type)
      Deprecated.
      Invoke a service method, using serialization.
      Specified by:
      invokeMethod in interface DaprClient
      Type Parameters:
      T - The Type of the return, use byte[] to skip serialization.
      Parameters:
      appId - The Application ID where the service is.
      methodName - 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.NONE otherwise.
      type - The Type needed as return for the call.
      Returns:
      A Mono Plan of type T.
    • invokeMethod

      @Deprecated public <T> reactor.core.publisher.Mono<T> invokeMethod(String appId, String methodName, Object request, HttpExtension httpExtension, Class<T> clazz)
      Deprecated.
      Invoke a service method, using serialization.
      Specified by:
      invokeMethod in interface DaprClient
      Type Parameters:
      T - The Type of the return, use byte[] to skip serialization.
      Parameters:
      appId - The Application ID where the service is.
      methodName - 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.NONE otherwise.
      clazz - The type needed as return for the call.
      Returns:
      A Mono Plan of type T.
    • invokeMethod

      @Deprecated public reactor.core.publisher.Mono<Void> invokeMethod(String appId, String methodName, Object request, HttpExtension httpExtension)
      Deprecated.
      Invoke a service method, using serialization.
      Specified by:
      invokeMethod in interface DaprClient
      Parameters:
      appId - The Application ID where the service is.
      methodName - 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.NONE otherwise.
      Returns:
      A Mono Plan of type Void.
    • invokeMethod

      @Deprecated public reactor.core.publisher.Mono<Void> invokeMethod(String appId, String methodName, Object request, HttpExtension httpExtension, Map<String,String> metadata)
      Deprecated.
      Invoke a service method, using serialization.
      Specified by:
      invokeMethod in interface DaprClient
      Parameters:
      appId - The Application ID where the service is.
      methodName - 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.NONE otherwise.
      metadata - Metadata (in GRPC) or headers (in HTTP) to be sent in request.
      Returns:
      A Mono Plan of type Void.
    • invokeMethod

      @Deprecated public reactor.core.publisher.Mono<Void> invokeMethod(String appId, String methodName, HttpExtension httpExtension, Map<String,String> metadata)
      Deprecated.
      Invoke a service method, using serialization.
      Specified by:
      invokeMethod in interface DaprClient
      Parameters:
      appId - The Application ID where the service is.
      methodName - The actual Method to be call in the application.
      httpExtension - Additional fields that are needed if the receiving app is listening on HTTP, HttpExtension.NONE otherwise.
      metadata - Metadata (in GRPC) or headers (in HTTP) to be sent in request.
      Returns:
      A Mono Plan of type Void.
    • invokeMethod

      @Deprecated public reactor.core.publisher.Mono<byte[]> invokeMethod(String appId, String methodName, byte[] request, HttpExtension httpExtension, Map<String,String> metadata)
      Deprecated.
      Invoke a service method, without using serialization.
      Specified by:
      invokeMethod in interface DaprClient
      Parameters:
      appId - The Application ID where the service is.
      methodName - 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.NONE otherwise.
      metadata - Metadata (in GRPC) or headers (in HTTP) to be sent in request.
      Returns:
      A Mono Plan of type byte[].
    • invokeBinding

      public reactor.core.publisher.Mono<Void> invokeBinding(String bindingName, String operation, Object data)
      Invokes a Binding operation.
      Specified by:
      invokeBinding in interface DaprClient
      Parameters:
      bindingName - The bindingName of the binding 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(String bindingName, String operation, byte[] data, Map<String,String> metadata)
      Invokes a Binding operation, skipping serialization.
      Specified by:
      invokeBinding in interface DaprClient
      Parameters:
      bindingName - The name of the binding 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(String bindingName, String operation, Object data, TypeRef<T> type)
      Invokes a Binding operation.
      Specified by:
      invokeBinding in interface DaprClient
      Type Parameters:
      T - The type of the return
      Parameters:
      bindingName - The name of the binding 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(String bindingName, String operation, Object data, Class<T> clazz)
      Invokes a Binding operation.
      Specified by:
      invokeBinding in interface DaprClient
      Type Parameters:
      T - The type of the return
      Parameters:
      bindingName - The name of the binding 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(String bindingName, String operation, Object data, Map<String,String> metadata, TypeRef<T> type)
      Invokes a Binding operation.
      Specified by:
      invokeBinding in interface DaprClient
      Type Parameters:
      T - The type of the return
      Parameters:
      bindingName - The name of the binding 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(String bindingName, String operation, Object data, Map<String,String> metadata, Class<T> clazz)
      Invokes a Binding operation.
      Specified by:
      invokeBinding in interface DaprClient
      Type Parameters:
      T - The type of the return
      Parameters:
      bindingName - The name of the binding 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.
    • invokeBinding

      public reactor.core.publisher.Mono<Void> invokeBinding(InvokeBindingRequest request)
      Invokes a Binding operation.
      Specified by:
      invokeBinding in interface DaprClient
      Parameters:
      request - The binding invocation request.
      Returns:
      a Mono with void.
    • getState

      public <T> reactor.core.publisher.Mono<State<T>> getState(String storeName, State<T> state, TypeRef<T> type)
      Retrieve a State based on their key.
      Specified by:
      getState in interface DaprClient
      Type Parameters:
      T - The type of the return.
      Parameters:
      storeName - 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(String storeName, State<T> state, Class<T> clazz)
      Retrieve a State based on their key.
      Specified by:
      getState in interface DaprClient
      Type Parameters:
      T - The type of the return.
      Parameters:
      storeName - 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(String storeName, String key, TypeRef<T> type)
      Retrieve a State based on their key.
      Specified by:
      getState in interface DaprClient
      Type Parameters:
      T - The type of the return.
      Parameters:
      storeName - 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(String storeName, String key, Class<T> clazz)
      Retrieve a State based on their key.
      Specified by:
      getState in interface DaprClient
      Type Parameters:
      T - The type of the return.
      Parameters:
      storeName - 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(String storeName, String key, StateOptions options, TypeRef<T> type)
      Retrieve a State based on their key.
      Specified by:
      getState in interface DaprClient
      Type Parameters:
      T - The Type of the return.
      Parameters:
      storeName - The name of the state store.
      key - The key of the State to be retrieved.
      options - 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(String storeName, String key, StateOptions options, Class<T> clazz)
      Retrieve a State based on their key.
      Specified by:
      getState in interface DaprClient
      Type Parameters:
      T - The Type of the return.
      Parameters:
      storeName - The name of the state store.
      key - The key of the State to be retrieved.
      options - Optional settings for retrieve operation.
      clazz - The Type of State needed as return.
      Returns:
      A Mono Plan for the requested State.
    • queryState

      public <T> reactor.core.publisher.Mono<QueryStateResponse<T>> queryState(String storeName, String query, Map<String,String> metadata, Class<T> clazz)
      Query for states using a query string.
      Specified by:
      queryState in interface DaprPreviewClient
      Type Parameters:
      T - The Type of the return, use byte[] to skip serialization.
      Parameters:
      storeName - Name of the state store to query.
      query - String value of the query.
      metadata - Optional metadata passed to the state store.
      clazz - The type needed as return for the call.
      Returns:
      A Mono of QueryStateResponse of type T.
    • queryState

      public <T> reactor.core.publisher.Mono<QueryStateResponse<T>> queryState(String storeName, String query, Map<String,String> metadata, TypeRef<T> type)
      Query for states using a query string.
      Specified by:
      queryState in interface DaprPreviewClient
      Type Parameters:
      T - The Type of the return, use byte[] to skip serialization.
      Parameters:
      storeName - Name of the state store to query.
      query - String value of the query.
      metadata - Optional metadata passed to the state store.
      type - The type needed as return for the call.
      Returns:
      A Mono of QueryStateResponse of type T.
    • queryState

      public <T> reactor.core.publisher.Mono<QueryStateResponse<T>> queryState(String storeName, String query, Class<T> clazz)
      Query for states using a query string.
      Specified by:
      queryState in interface DaprPreviewClient
      Type Parameters:
      T - The Type of the return, use byte[] to skip serialization.
      Parameters:
      storeName - Name of the state store to query.
      query - String value of the query.
      clazz - The type needed as return for the call.
      Returns:
      A Mono of QueryStateResponse of type T.
    • queryState

      public <T> reactor.core.publisher.Mono<QueryStateResponse<T>> queryState(String storeName, String query, TypeRef<T> type)
      Query for states using a query string.
      Specified by:
      queryState in interface DaprPreviewClient
      Type Parameters:
      T - The Type of the return, use byte[] to skip serialization.
      Parameters:
      storeName - Name of the state store to query.
      query - String value of the query.
      type - The type needed as return for the call.
      Returns:
      A Mono of QueryStateResponse of type T.
    • queryState

      public <T> reactor.core.publisher.Mono<QueryStateResponse<T>> queryState(String storeName, Query query, Map<String,String> metadata, Class<T> clazz)
      Query for states using a query domain object.
      Specified by:
      queryState in interface DaprPreviewClient
      Type Parameters:
      T - The Type of the return, use byte[] to skip serialization.
      Parameters:
      storeName - Name of the state store to query.
      query - Query value domain object.
      metadata - Optional metadata passed to the state store.
      clazz - The type needed as return for the call.
      Returns:
      A Mono of QueryStateResponse of type T.
    • queryState

      public <T> reactor.core.publisher.Mono<QueryStateResponse<T>> queryState(String storeName, Query query, Map<String,String> metadata, TypeRef<T> type)
      Query for states using a query domain object.
      Specified by:
      queryState in interface DaprPreviewClient
      Type Parameters:
      T - The Type of the return, use byte[] to skip serialization.
      Parameters:
      storeName - Name of the state store to query.
      query - Query value domain object.
      metadata - Optional metadata passed to the state store.
      type - The type needed as return for the call.
      Returns:
      A Mono of QueryStateResponse of type T.
    • queryState

      public <T> reactor.core.publisher.Mono<QueryStateResponse<T>> queryState(String storeName, Query query, Class<T> clazz)
      Query for states using a query domain object.
      Specified by:
      queryState in interface DaprPreviewClient
      Type Parameters:
      T - The Type of the return, use byte[] to skip serialization.
      Parameters:
      storeName - Name of the state store to query.
      query - Query value domain object.
      clazz - The type needed as return for the call.
      Returns:
      A Mono of QueryStateResponse of type T.
    • queryState

      public <T> reactor.core.publisher.Mono<QueryStateResponse<T>> queryState(String storeName, Query query, TypeRef<T> type)
      Query for states using a query domain object.
      Specified by:
      queryState in interface DaprPreviewClient
      Type Parameters:
      T - The Type of the return, use byte[] to skip serialization.
      Parameters:
      storeName - Name of the state store to query.
      query - Query value domain object.
      type - The type needed as return for the call.
      Returns:
      A Mono of QueryStateResponse of type T.
    • queryState

      public <T> reactor.core.publisher.Mono<QueryStateResponse<T>> queryState(QueryStateRequest request, Class<T> clazz)
      Query for states using a query request.
      Specified by:
      queryState in interface DaprPreviewClient
      Type Parameters:
      T - The Type of the return, use byte[] to skip serialization.
      Parameters:
      request - Query request object.
      clazz - The type needed as return for the call.
      Returns:
      A Mono of QueryStateResponse of type T.
    • publishEvents

      public <T> reactor.core.publisher.Mono<BulkPublishResponse<T>> publishEvents(String pubsubName, String topicName, String contentType, List<T> events)
      Publish multiple events to Dapr in a single request.
      Specified by:
      publishEvents in interface DaprClient
      Specified by:
      publishEvents in interface DaprPreviewClient
      Type Parameters:
      T - The type of the events to publish in the call.
      Parameters:
      pubsubName - the pubsub name we will publish the event to.
      topicName - the topicName where the event will be published.
      contentType - the content type of the event. Use Mime based types.
      events - the List of events to be published.
      Returns:
      the BulkPublishResponse containing publish status of each event. The "entryID" field in BulkPublishEntry in BulkPublishResponseFailedEntry will be generated based on the order of events in the List.
    • publishEvents

      public <T> reactor.core.publisher.Mono<BulkPublishResponse<T>> publishEvents(String pubsubName, String topicName, String contentType, T... events)
      Publish multiple events to Dapr in a single request.
      Specified by:
      publishEvents in interface DaprClient
      Specified by:
      publishEvents in interface DaprPreviewClient
      Type Parameters:
      T - The type of the events to publish in the call.
      Parameters:
      pubsubName - the pubsub name we will publish the event to.
      topicName - the topicName where the event will be published.
      contentType - the content type of the event. Use Mime based types.
      events - the varargs of events to be published.
      Returns:
      the BulkPublishResponse containing publish status of each event. The "entryID" field in BulkPublishEntry in BulkPublishResponseFailedEntry will be generated based on the order of events in the List.
    • publishEvents

      public <T> reactor.core.publisher.Mono<BulkPublishResponse<T>> publishEvents(String pubsubName, String topicName, String contentType, Map<String,String> requestMetadata, T... events)
      Publish multiple events to Dapr in a single request.
      Specified by:
      publishEvents in interface DaprClient
      Specified by:
      publishEvents in interface DaprPreviewClient
      Type Parameters:
      T - The type of the events to publish in the call.
      Parameters:
      pubsubName - the pubsub name we will publish the event to.
      topicName - the topicName where the event will be published.
      contentType - the content type of the event. Use Mime based types.
      requestMetadata - the metadata to be set at the request level for the BulkPublishRequest.
      events - the varargs of events to be published.
      Returns:
      the BulkPublishResponse containing publish status of each event. The "entryID" field in BulkPublishEntry in BulkPublishResponseFailedEntry will be generated based on the order of events in the List.
    • publishEvents

      public <T> reactor.core.publisher.Mono<BulkPublishResponse<T>> publishEvents(String pubsubName, String topicName, String contentType, Map<String,String> requestMetadata, List<T> events)
      Publish multiple events to Dapr in a single request.
      Specified by:
      publishEvents in interface DaprClient
      Specified by:
      publishEvents in interface DaprPreviewClient
      Type Parameters:
      T - The type of the events to publish in the call.
      Parameters:
      pubsubName - the pubsub name we will publish the event to.
      topicName - the topicName where the event will be published.
      contentType - the content type of the event. Use Mime based types.
      requestMetadata - the metadata to be set at the request level for the BulkPublishRequest.
      events - the List of events to be published.
      Returns:
      the BulkPublishResponse containing publish status of each event. The "entryID" field in BulkPublishEntry in BulkPublishResponseFailedEntry will be generated based on the order of events in the List.
    • getBulkState

      public <T> reactor.core.publisher.Mono<List<State<T>>> getBulkState(String storeName, List<String> keys, TypeRef<T> type)
      Retrieve bulk States based on their keys.
      Specified by:
      getBulkState in interface DaprClient
      Type Parameters:
      T - The type of the return.
      Parameters:
      storeName - The name of the state store.
      keys - The keys of the State to be retrieved.
      type - The type of State needed as return.
      Returns:
      A Mono Plan for the requested State.
    • getBulkState

      public <T> reactor.core.publisher.Mono<List<State<T>>> getBulkState(String storeName, List<String> keys, Class<T> clazz)
      Retrieve bulk States based on their keys.
      Specified by:
      getBulkState in interface DaprClient
      Type Parameters:
      T - The type of the return.
      Parameters:
      storeName - The name of the state store.
      keys - The keys of the State to be retrieved.
      clazz - The type of State needed as return.
      Returns:
      A Mono Plan for the requested State.
    • executeStateTransaction

      public reactor.core.publisher.Mono<Void> executeStateTransaction(String storeName, List<TransactionalStateOperation<?>> operations)
      Execute a transaction.
      Specified by:
      executeStateTransaction in interface DaprClient
      Parameters:
      storeName - The name of the state store.
      operations - The operations to be performed.
      Returns:
      a Mono plan of type Void
    • saveBulkState

      public reactor.core.publisher.Mono<Void> saveBulkState(String storeName, List<State<?>> states)
      Save/Update a list of states.
      Specified by:
      saveBulkState in interface DaprClient
      Parameters:
      storeName - 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<Void> saveState(String storeName, String key, Object value)
      Save/Update a state.
      Specified by:
      saveState in interface DaprClient
      Parameters:
      storeName - 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<Void> saveState(String storeName, String key, String etag, Object value, StateOptions options)
      Save/Update a state.
      Specified by:
      saveState in interface DaprClient
      Parameters:
      storeName - 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.
    • saveState

      public reactor.core.publisher.Mono<Void> saveState(String storeName, String key, String etag, Object value, Map<String,String> meta, StateOptions options)
      Save/Update a state.
      Specified by:
      saveState in interface DaprClient
      Parameters:
      storeName - The name of the state store.
      key - The key of the state.
      etag - The etag to be used.
      value - The value of the state.
      meta - The metadata to be set to the state.
      options - The Options to use for each state.
      Returns:
      a Mono plan of type Void.
    • deleteState

      public reactor.core.publisher.Mono<Void> deleteState(String storeName, String key)
      Delete a state.
      Specified by:
      deleteState in interface DaprClient
      Parameters:
      storeName - 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<Void> deleteState(String storeName, String key, String etag, StateOptions options)
      Delete a state.
      Specified by:
      deleteState in interface DaprClient
      Parameters:
      storeName - 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<Map<String,String>> getSecret(String storeName, String key, Map<String,String> metadata)
      Fetches a secret from the configured vault.
      Specified by:
      getSecret in interface DaprClient
      Parameters:
      storeName - Name of vault component in Dapr.
      key - Secret to be fetched.
      metadata - Optional metadata.
      Returns:
      Key-value pairs for the secret.
    • getSecret

      public reactor.core.publisher.Mono<Map<String,String>> getSecret(String storeName, String secretName)
      Fetches a secret from the configured vault.
      Specified by:
      getSecret in interface DaprClient
      Parameters:
      storeName - Name of vault component in Dapr.
      secretName - Secret to be fetched.
      Returns:
      Key-value pairs for the secret.
    • getBulkSecret

      public reactor.core.publisher.Mono<Map<String,Map<String,String>>> getBulkSecret(String storeName)
      Fetches all secrets from the configured vault.
      Specified by:
      getBulkSecret in interface DaprClient
      Parameters:
      storeName - Name of vault component in Dapr.
      Returns:
      Key-value pairs for all the secrets in the state store.
    • getBulkSecret

      public reactor.core.publisher.Mono<Map<String,Map<String,String>>> getBulkSecret(String storeName, Map<String,String> metadata)
      Fetches all secrets from the configured vault.
      Specified by:
      getBulkSecret in interface DaprClient
      Parameters:
      storeName - Name of vault component in Dapr.
      metadata - Optional metadata.
      Returns:
      Key-value pairs for all the secrets in the state store.
    • getConfiguration

      public reactor.core.publisher.Mono<ConfigurationItem> getConfiguration(String storeName, String key)
      Retrieve a configuration based on a provided key.
      Specified by:
      getConfiguration in interface DaprClient
      Parameters:
      storeName - Name of the configuration store
      key - key of the configuration item which is to be retrieved
      Returns:
      Mono of the Configuration Item
    • getConfiguration

      public reactor.core.publisher.Mono<ConfigurationItem> getConfiguration(String storeName, String key, Map<String,String> metadata)
      Retrieve a configuration based on a provided key.
      Specified by:
      getConfiguration in interface DaprClient
      Parameters:
      storeName - Name of the configuration store
      key - key of the configuration item which is to be retrieved
      metadata - optional metadata
      Returns:
      Mono of the Configuration Item
    • getConfiguration

      public reactor.core.publisher.Mono<Map<String,ConfigurationItem>> getConfiguration(String storeName, String... keys)
      Retrieve Map of configurations based on a provided variable number of keys.
      Specified by:
      getConfiguration in interface DaprClient
      Parameters:
      storeName - Name of the configuration store
      keys - keys of the configurations which are to be retrieved
      Returns:
      Mono of Map of ConfigurationItems
    • getConfiguration

      public reactor.core.publisher.Mono<Map<String,ConfigurationItem>> getConfiguration(String storeName, List<String> keys, Map<String,String> metadata)
      Retrieve Map of configurations based on a provided variable number of keys.
      Specified by:
      getConfiguration in interface DaprClient
      Parameters:
      storeName - Name of the configuration store
      keys - keys of the configurations which are to be retrieved
      metadata - optional metadata
      Returns:
      Mono of Map of ConfigurationItems
    • subscribeConfiguration

      public reactor.core.publisher.Flux<SubscribeConfigurationResponse> subscribeConfiguration(String storeName, String... keys)
      Subscribe to the keys for any change.
      Specified by:
      subscribeConfiguration in interface DaprClient
      Parameters:
      storeName - Name of the configuration store
      keys - keys of the configurations which are to be subscribed
      Returns:
      Flux of SubscribeConfigurationResponse instance
    • subscribeConfiguration

      public reactor.core.publisher.Flux<SubscribeConfigurationResponse> subscribeConfiguration(String storeName, List<String> keys, Map<String,String> metadata)
      Subscribe to the keys for any change.
      Specified by:
      subscribeConfiguration in interface DaprClient
      Parameters:
      storeName - Name of the configuration store
      keys - keys of the configurations which are to be subscribed
      metadata - optional metadata
      Returns:
      Flux of SubscribeConfigurationResponse instance
    • unsubscribeConfiguration

      public reactor.core.publisher.Mono<UnsubscribeConfigurationResponse> unsubscribeConfiguration(String id, String storeName)
      Unsubscribe from previously subscribed keys.
      Specified by:
      unsubscribeConfiguration in interface DaprClient
      Parameters:
      id - subscription id returned by subscribeConfiguration API.
      storeName - Name of the configuration store.
      Returns:
      Mono of UnsubscribeConfigurationResponse instance.
    • tryLock

      public reactor.core.publisher.Mono<Boolean> tryLock(String storeName, String resourceId, String lockOwner, Integer expiryInSeconds)
      Tries to get a lock with an expiry.
      Specified by:
      tryLock in interface DaprPreviewClient
      Parameters:
      storeName - Name of the store
      resourceId - Lock key
      lockOwner - The identifier of lock owner
      expiryInSeconds - The time before expiry
      Returns:
      Whether the lock is successful
    • unlock

      public reactor.core.publisher.Mono<UnlockResponseStatus> unlock(String storeName, String resourceId, String lockOwner)
      Unlocks a lock.
      Specified by:
      unlock in interface DaprPreviewClient
      Parameters:
      storeName - Name of the store
      resourceId - Lock key
      lockOwner - The identifier of lock owner
      Returns:
      Unlock result