Table of Contents

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

key StateStoreKey

The key to delete from the State Store.

options StateStoreDeleteRequestOptions

The optional parameters for this request. OnlyDeleteIfValueEquals allows for conditional deletion.

requestTimeout TimeSpan?

The request timeout.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<IStateStoreDeleteResponse>

The details of the service response.

DisposeAsync(bool)

Asynchronously dispose of this client and optionally dispose the underlying MQTT client

ValueTask DisposeAsync(bool disposing)

Parameters

disposing bool

If true, this client will also dispose the underlying MQTT client.

Returns

ValueTask

DisposeAsync(bool, CancellationToken)

Asynchronously dispose of this client and optionally dispose the underlying MQTT client

ValueTask DisposeAsync(bool disposing, CancellationToken cancellationToken)

Parameters

disposing bool

If true, this client will also dispose the underlying MQTT client.

cancellationToken CancellationToken

Cancellation token

Returns

ValueTask

DisposeAsync(CancellationToken)

Asynchronously dispose this object, but not the underlying mqtt client.

ValueTask DisposeAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Cancellation token

Returns

ValueTask

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

key StateStoreKey

The key to get the value of.

requestTimeout TimeSpan?

The optional timeout for this request.

cancellationToken CancellationToken

Cancellation 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

key StateStoreKey

The key to receive notifications about.

requestTimeout TimeSpan?

The optional timeout for this request.

cancellationToken CancellationToken

Cancellation token.

Returns

Task

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

key StateStoreKey

The key to set in the State Store.

value StateStoreValue

The value to assign key in the State Store.

options StateStoreSetRequestOptions

The parameters for this request including the key and value to use. Condition allows for conditional setting/overwriting of values.

requestTimeout TimeSpan?

The optional timeout for this request.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<IStateStoreSetResponse>

The service response detailing if the operation succeeded and (optionally) the previous value of this key.

StopAsync(CancellationToken)

Make this client unsubscribe from any topics that it subscribed to.

Task StopAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task

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

key StateStoreKey

The key to stop receiving events about.

requestTimeout TimeSpan?

The optional timeout for this request.

cancellationToken CancellationToken

Cancellation token.

Returns

Task

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

Event Type

Func<object, KeyChangeMessageReceivedEventArgs, Task>