Class StateStore.Service
- Namespace
- Azure.Iot.Operations.Services.StateStore.StateStore
- Assembly
- Azure.Iot.Operations.Services.dll
public abstract class StateStore.Service : IAsyncDisposable
- Inheritance
-
StateStore.Service
- Implements
- Inherited Members
Constructors
Service(ApplicationContext, IMqttPubSubClient, Dictionary<string, string>?)
Construct a new instance of this service.
public Service(ApplicationContext applicationContext, IMqttPubSubClient mqttClient, Dictionary<string, string>? topicTokenMap = null)
Parameters
applicationContext
ApplicationContextThe shared context for your application.
mqttClient
IMqttPubSubClientThe MQTT client to use.
topicTokenMap
Dictionary<string, string>The topic token replacement map to use for all operations by default. Generally, this will include the token values for topic tokens such as "modelId" which should be the same for the duration of this service's lifetime. Note that additional topic tokens can be specified when starting the service with StartAsync(Dictionary<string, string>?, int?, CancellationToken) and can be specified per-telemetry message.
Properties
InvokeCommandExecutor
public StateStore.InvokeCommandExecutor InvokeCommandExecutor { get; }
Property Value
Methods
DisposeAsync()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
public ValueTask DisposeAsync()
Returns
- ValueTask
A task that represents the asynchronous dispose operation.
DisposeAsync(bool)
public ValueTask DisposeAsync(bool disposing)
Parameters
disposing
bool
Returns
InvokeAsync(byte[], CommandRequestMetadata, CancellationToken)
public abstract Task<ExtendedResponse<byte[]>> InvokeAsync(byte[] request, CommandRequestMetadata requestMetadata, CancellationToken cancellationToken)
Parameters
request
byte[]requestMetadata
CommandRequestMetadatacancellationToken
CancellationToken
Returns
- Task<ExtendedResponse<byte[]>>
StartAsync(int?, CancellationToken)
Begin accepting command invocations for all command executors.
public Task StartAsync(int? preferredDispatchConcurrency = null, CancellationToken cancellationToken = default)
Parameters
preferredDispatchConcurrency
int?The dispatch concurrency count for the command response cache to use.
cancellationToken
CancellationTokenCancellation token.
Returns
Remarks
Specifying custom topic tokens in additionalTopicTokenMap
allows you to make command executors only
accept commands over a specific topic.
Note that a given command executor can only be started with one set of topic token replacements. If you want a command executor to only handle commands for several specific sets of topic token values (as opposed to all possible topic token values), then you will instead need to create a command executor per topic token set.
StopAsync(CancellationToken)
public Task StopAsync(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationToken