Interface DaprPreviewClient
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
DaprClientImpl
-
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<ConversationResponse>converse(ConversationRequest conversationRequest) Deprecated.reactor.core.publisher.Mono<ConversationResponseAlpha2>converseAlpha2(ConversationRequestAlpha2 conversationRequestAlpha2) reactor.core.publisher.Flux<byte[]>decrypt(DecryptRequestAlpha1 request) Decrypt data using the Dapr cryptography building block.reactor.core.publisher.Mono<Void>deleteBinaryFile(String storeName, String fileName) Deletes a file from a binary store component.reactor.core.publisher.Flux<byte[]>encrypt(EncryptRequestAlpha1 request) Encrypt data using the Dapr cryptography building block.reactor.core.publisher.Flux<byte[]>getBinaryFile(String storeName, String fileName) Reads a file from a binary store component as a stream of chunks.reactor.core.publisher.Mono<byte[]>getBinaryFileBytes(String storeName, String fileName) Reads a whole file from a binary store component into memory.<T> reactor.core.publisher.Mono<BulkPublishResponse<T>>publishEvents(BulkPublishRequest<T> request) Deprecated.This method is now stable.<T> reactor.core.publisher.Mono<BulkPublishResponse<T>>publishEvents(String pubsubName, String topicName, String contentType, List<T> events) Deprecated.This method is now stable.<T> reactor.core.publisher.Mono<BulkPublishResponse<T>>publishEvents(String pubsubName, String topicName, String contentType, Map<String, String> requestMetadata, List<T> events) Deprecated.This method is now stable.<T> reactor.core.publisher.Mono<BulkPublishResponse<T>>publishEvents(String pubsubName, String topicName, String contentType, Map<String, String> requestMetadata, T... events) Deprecated.This method is now stable.<T> reactor.core.publisher.Mono<BulkPublishResponse<T>>publishEvents(String pubsubName, String topicName, String contentType, T... events) Deprecated.This method is now stable.<T> reactor.core.publisher.Mono<QueryStateResponse<T>>queryState(QueryStateRequest request, TypeRef<T> type) Query for states using a query request.<T> reactor.core.publisher.Mono<QueryStateResponse<T>>queryState(QueryStateRequest request, Class<T> clazz) Query for states using a query request.<T> reactor.core.publisher.Mono<QueryStateResponse<T>>queryState(String storeName, Query query, TypeRef<T> type) Query for states using a query domain object.<T> reactor.core.publisher.Mono<QueryStateResponse<T>>queryState(String storeName, Query query, Class<T> clazz) Query for states using a query domain object.<T> reactor.core.publisher.Mono<QueryStateResponse<T>>Query for states using a query domain object.<T> reactor.core.publisher.Mono<QueryStateResponse<T>>Query for states using a query domain object.<T> reactor.core.publisher.Mono<QueryStateResponse<T>>queryState(String storeName, String query, TypeRef<T> type) Query for states using a query string.<T> reactor.core.publisher.Mono<QueryStateResponse<T>>queryState(String storeName, String query, Class<T> clazz) Query for states using a query string.<T> reactor.core.publisher.Mono<QueryStateResponse<T>>Query for states using a query string.<T> reactor.core.publisher.Mono<QueryStateResponse<T>>Query for states using a query string.reactor.core.publisher.Mono<Void>setBinaryFile(SetBinaryFileRequestAlpha1 request) Stores a file in a binary store component.reactor.core.publisher.Mono<Void>setBinaryFile(String storeName, String fileName, byte[] content, boolean overwrite) Stores a file in a binary store component from a byte array.<T> SubscriptionsubscribeToEvents(String pubsubName, String topic, SubscriptionListener<T> listener, TypeRef<T> type) Deprecated.UsesubscribeToTopic(String, String, TypeRef)instead for a more reactive approach.<T> reactor.core.publisher.Flux<T>subscribeToEvents(String pubsubName, String topic, TypeRef<T> type) Deprecated.UsesubscribeToTopic(String, String, TypeRef)instead.<T> reactor.core.publisher.Flux<T>Deprecated.UsesubscribeToTopic(String, String, TypeRef, Map)instead.<T> SubscriptionsubscribeToEvents(String pubsubName, String topic, String deadLetterTopic, SubscriptionListener<T> listener, TypeRef<T> type) Deprecated.UsesubscribeToTopic(String, String, String, TypeRef)instead for a more reactive approach.<T> reactor.core.publisher.Flux<T>subscribeToTopic(String pubsubName, String topic, TypeRef<T> type) Subscribe to pubsub events via streaming using Project Reactor Flux.<T> reactor.core.publisher.Flux<T>Subscribe to pubsub events via streaming using Project Reactor Flux with metadata support.<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.<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.reactor.core.publisher.Mono<Boolean>tryLock(LockRequest request) Tries to get a lock with an expiry.reactor.core.publisher.Mono<Boolean>Tries to get a lock with an expiry.reactor.core.publisher.Mono<UnlockResponseStatus>unlock(UnlockRequest request) Unlocks a lock.reactor.core.publisher.Mono<UnlockResponseStatus>Unlocks a lock.Methods inherited from interface java.lang.AutoCloseable
close
-
Method Details
-
queryState
<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.- 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
<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.- 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
<T> reactor.core.publisher.Mono<QueryStateResponse<T>> queryState(String storeName, String query, Class<T> clazz) Query for states using a query string.- 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
<T> reactor.core.publisher.Mono<QueryStateResponse<T>> queryState(String storeName, String query, TypeRef<T> type) Query for states using a query string.- 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
<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.- 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
<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.- 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
<T> reactor.core.publisher.Mono<QueryStateResponse<T>> queryState(String storeName, Query query, Class<T> clazz) Query for states using a query domain object.- 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
<T> reactor.core.publisher.Mono<QueryStateResponse<T>> queryState(String storeName, Query query, TypeRef<T> type) Query for states using a query domain object.- 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
<T> reactor.core.publisher.Mono<QueryStateResponse<T>> queryState(QueryStateRequest request, Class<T> clazz) 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.clazz- The type needed as return for the call.- Returns:
- A Mono of QueryStateResponse of type T.
-
queryState
<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.
-
publishEvents
@Deprecated <T> reactor.core.publisher.Mono<BulkPublishResponse<T>> publishEvents(BulkPublishRequest<T> request) Deprecated.This method is now stable. UseDaprClient.publishEvents(BulkPublishRequest)instead.Publish multiple events to Dapr in a single request.- Type Parameters:
T- The type of events to publish in the call.- Parameters:
request-BulkPublishRequestobject.- Returns:
- A Mono of
BulkPublishResponseobject.
-
publishEvents
@Deprecated <T> reactor.core.publisher.Mono<BulkPublishResponse<T>> publishEvents(String pubsubName, String topicName, String contentType, List<T> events) Deprecated.This method is now stable. UseDaprClient.publishEvents(String, String, String, List)instead.Publish multiple events to Dapr in a single request.- 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.events- theListof events to be published.contentType- the content type of the event. Use Mime based types.- Returns:
- the
BulkPublishResponsecontaining publish status of each event. The "entryID" field inBulkPublishEntryinBulkPublishResponseFailedEntrywill be generated based on the order of events in theList.
-
publishEvents
@Deprecated <T> reactor.core.publisher.Mono<BulkPublishResponse<T>> publishEvents(String pubsubName, String topicName, String contentType, T... events) Deprecated.This method is now stable. UseDaprClient.publishEvents(String, String, String, Object[])instead.Publish multiple events to Dapr in a single request.- 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.events- the varargs of events to be published.contentType- the content type of the event. Use Mime based types.- Returns:
- the
BulkPublishResponsecontaining publish status of each event. The "entryID" field inBulkPublishEntryinBulkPublishResponseFailedEntrywill be generated based on the order of events in theList.
-
publishEvents
@Deprecated <T> reactor.core.publisher.Mono<BulkPublishResponse<T>> publishEvents(String pubsubName, String topicName, String contentType, Map<String, String> requestMetadata, List<T> events) Deprecated.This method is now stable. UseDaprClient.publishEvents(String, String, String, Map, List)instead.Publish multiple events to Dapr in a single request.- 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.events- theListof events to be published.contentType- the content type of the event. Use Mime based types.requestMetadata- the metadata to be set at the request level for theBulkPublishRequest.- Returns:
- the
BulkPublishResponsecontaining publish status of each event. The "entryID" field inBulkPublishEntryinBulkPublishResponseFailedEntrywill be generated based on the order of events in theList.
-
publishEvents
@Deprecated <T> reactor.core.publisher.Mono<BulkPublishResponse<T>> publishEvents(String pubsubName, String topicName, String contentType, Map<String, String> requestMetadata, T... events) Deprecated.This method is now stable. UseDaprClient.publishEvents(String, String, String, Map, Object[])instead.Publish multiple events to Dapr in a single request.- 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.events- the varargs of events to be published.contentType- the content type of the event. Use Mime based types.requestMetadata- the metadata to be set at the request level for theBulkPublishRequest.- Returns:
- the
BulkPublishResponsecontaining publish status of each event. The "entryID" field inBulkPublishEntryinBulkPublishResponseFailedEntrywill be generated based on the order of events in theList.
-
tryLock
reactor.core.publisher.Mono<Boolean> tryLock(String storeName, String resourceId, String lockOwner, Integer expiryInSeconds) Tries to get a lock with an expiry.- Parameters:
storeName- Name of the storeresourceId- Lock keylockOwner- The identifier of lock ownerexpiryInSeconds- The time before expiry- Returns:
- Whether the lock is successful
-
tryLock
Tries to get a lock with an expiry.- Parameters:
request- The request to lock- Returns:
- Whether the lock is successful
-
unlock
reactor.core.publisher.Mono<UnlockResponseStatus> unlock(String storeName, String resourceId, String lockOwner) Unlocks a lock.- Parameters:
storeName- Name of the storeresourceId- Lock keylockOwner- The identifier of lock owner- Returns:
- Unlock result
-
unlock
Unlocks a lock.- Parameters:
request- The request to unlock- Returns:
- Unlock result
-
subscribeToEvents
@Deprecated <T> Subscription subscribeToEvents(String pubsubName, String topic, SubscriptionListener<T> listener, TypeRef<T> type) Deprecated.UsesubscribeToTopic(String, String, TypeRef)instead for a more reactive approach.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
@Deprecated <T> Subscription subscribeToEvents(String pubsubName, String topic, String deadLetterTopic, SubscriptionListener<T> listener, TypeRef<T> type) Deprecated.UsesubscribeToTopic(String, String, String, TypeRef)instead for a more reactive approach.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 <T> reactor.core.publisher.Flux<T> subscribeToEvents(String pubsubName, String topic, TypeRef<T> type) Deprecated.UsesubscribeToTopic(String, String, TypeRef)instead.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 <T> reactor.core.publisher.Flux<T> subscribeToEvents(String pubsubName, String topic, TypeRef<T> type, Map<String, String> metadata) Deprecated.UsesubscribeToTopic(String, String, TypeRef, Map)instead.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
<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.STRINGor 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.
- Use
-
subscribeToTopic
<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
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
<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
<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.
-
converse
@Deprecated reactor.core.publisher.Mono<ConversationResponse> converse(ConversationRequest conversationRequest) Deprecated. -
converseAlpha2
reactor.core.publisher.Mono<ConversationResponseAlpha2> converseAlpha2(ConversationRequestAlpha2 conversationRequestAlpha2) -
encrypt
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).
- Throws:
IllegalArgumentException- if required parameters are missing.
-
decrypt
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).
- Throws:
IllegalArgumentException- if required parameters are missing.
-
deleteBinaryFile
Deletes a file from a binary store component.If the file does not exist, the Mono fails with the NOT_FOUND error code. This is an alpha API. Its name and behavior can change in a later release.
- Parameters:
storeName- Name of the binary store component.fileName- Name of the file to delete.- Returns:
- An empty Mono that completes when the sidecar deletes the file.
- Throws:
IllegalArgumentException- if storeName or fileName is null or blank.
-
getBinaryFile
Reads a file from a binary store component as a stream of chunks.The chunks arrive in file order. Cancel the subscription to stop the download. If the file does not exist, the Flux fails with the NOT_FOUND error code. A timeout set with dapr.api.timeoutMilliseconds applies to the whole download. This is an alpha API. Its name and behavior can change in a later release.
- Parameters:
storeName- Name of the binary store component.fileName- Name of the file to read.- Returns:
- A Flux of file chunks.
- Throws:
IllegalArgumentException- if storeName or fileName is null or blank.
-
getBinaryFileBytes
Reads a whole file from a binary store component into memory.This method holds the whole file in memory. Use
getBinaryFile(String, String)for large files. This is an alpha API. Its name and behavior can change in a later release.- Parameters:
storeName- Name of the binary store component.fileName- Name of the file to read.- Returns:
- A Mono with the file content. An empty file gives an empty array.
- Throws:
IllegalArgumentException- if storeName or fileName is null or blank.
-
setBinaryFile
Stores a file in a binary store component.The SDK sends the content in chunks of at most 32 KiB. If overwrite is false and the file exists, the call fails with the ALREADY_EXISTS error code. The SDK does not apply gRPC flow control: if the content Flux produces data faster than the network sends it, gRPC holds the extra data in memory. Each subscription to the returned Mono subscribes to the content Flux again. To retry, use a content Flux that supports more than one subscription. A timeout set with dapr.api.timeoutMilliseconds applies to the whole upload. This is an alpha API. Its name and behavior can change in a later release.
- Parameters:
request- The request with the store name, file name, content, and overwrite flag.- Returns:
- An empty Mono that completes when the sidecar stores the file.
- Throws:
IllegalArgumentException- if the request, store name, file name, or content is missing.
-
setBinaryFile
reactor.core.publisher.Mono<Void> setBinaryFile(String storeName, String fileName, byte[] content, boolean overwrite) Stores a file in a binary store component from a byte array.The SDK sends the content in chunks of at most 32 KiB. This is an alpha API. Its name and behavior can change in a later release.
- Parameters:
storeName- Name of the binary store component.fileName- Name of the file to store.content- File content.overwrite- true to replace an existing file, false to fail when the file exists.- Returns:
- An empty Mono that completes when the sidecar stores the file.
- Throws:
IllegalArgumentException- if storeName, fileName, or content is missing.
-