Interface IStateStoreClient
- Namespace
- Azure.Iot.Operations.Services.StateStore
- Assembly
- Azure.Iot.Operations.Services.dll
The interface for interacting with a generic state store.
public interface IStateStoreClient : IAsyncDisposable
- Inherited Members
Remarks
StateStoreClient provides an implementation of this interface for the state store that is part of Akri MQ.
Methods
DeleteAsync(StateStoreKey, StateStoreDeleteRequestOptions?, TimeSpan?, CancellationToken)
Delete the provided key from the State Store.
Task<IStateStoreDeleteResponse> DeleteAsync(StateStoreKey key, StateStoreDeleteRequestOptions? options = null, TimeSpan? requestTimeout = null, CancellationToken cancellationToken = default)
Parameters
keyStateStoreKeyThe key to delete from the State Store.
optionsStateStoreDeleteRequestOptionsThe optional parameters for this request. OnlyDeleteIfValueEquals allows for conditional deletion.
requestTimeoutTimeSpan?The request timeout.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<IStateStoreDeleteResponse>
The details of the service response.
DisposeAsync(bool)
ValueTask DisposeAsync(bool disposing)
Parameters
disposingbool
Returns
GetAsync(StateStoreKey, TimeSpan?, CancellationToken)
Get the value of a key from the State Store.
Task<IStateStoreGetResponse> GetAsync(StateStoreKey key, TimeSpan? requestTimeout = null, CancellationToken cancellationToken = default)
Parameters
keyStateStoreKeyThe key to get the value of.
requestTimeoutTimeSpan?The optional timeout for this request.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<IStateStoreGetResponse>
The service response containing the current value of the key in the State Store.
ObserveAsync(StateStoreKey, TimeSpan?, CancellationToken)
Begin receiving events each time the provided key is updated, deleted, or created. Events will be delivered via KeyChangeMessageReceivedAsync.
Task ObserveAsync(StateStoreKey key, TimeSpan? requestTimeout = null, CancellationToken cancellationToken = default)
Parameters
keyStateStoreKeyThe key to receive notifications about.
requestTimeoutTimeSpan?The optional timeout for this request.
cancellationTokenCancellationTokenCancellation token.
Returns
Remarks
This method does not support using wildcard characters to subscribe to multiple keys at once.
SetAsync(StateStoreKey, StateStoreValue, StateStoreSetRequestOptions?, TimeSpan?, CancellationToken)
Set the value of a key in the State Store.
Task<IStateStoreSetResponse> SetAsync(StateStoreKey key, StateStoreValue value, StateStoreSetRequestOptions? options = null, TimeSpan? requestTimeout = null, CancellationToken cancellationToken = default)
Parameters
keyStateStoreKeyThe key to set in the State Store.
valueStateStoreValueThe value to assign
keyin the State Store.optionsStateStoreSetRequestOptionsThe parameters for this request including the key and value to use. Condition allows for conditional setting/overwriting of values.
requestTimeoutTimeSpan?The optional timeout for this request.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<IStateStoreSetResponse>
The service response detailing if the operation succeeded and (optionally) the previous value of this key.
UnobserveAsync(StateStoreKey, TimeSpan?, CancellationToken)
Stop receiving events each time the provided key is updated, created, or deleted.
Task UnobserveAsync(StateStoreKey key, TimeSpan? requestTimeout = null, CancellationToken cancellationToken = default)
Parameters
keyStateStoreKeyThe key to stop receiving events about.
requestTimeoutTimeSpan?The optional timeout for this request.
cancellationTokenCancellationTokenCancellation token.
Returns
Remarks
This method does not support using wildcard characters to unsubscribe from multiple keys at once.
Events
KeyChangeMessageReceivedAsync
The event that executes each time an observed key is changed.
event Func<object?, KeyChangeMessageReceivedEventArgs, Task>? KeyChangeMessageReceivedAsync