Table of Contents

Interface IDatasetSampler

Namespace
Azure.Iot.Operations.Connector
Assembly
Azure.Iot.Operations.Connector.dll

An object used by a connector to periodically sample a dataset on an asset.

public interface IDatasetSampler

Methods

GetSamplingIntervalAsync(AssetDataset, CancellationToken)

Task<TimeSpan> GetSamplingIntervalAsync(AssetDataset dataset, CancellationToken cancellationToken = default)

Parameters

dataset AssetDataset
cancellationToken CancellationToken

Returns

Task<TimeSpan>

SampleDatasetAsync(AssetDataset, CancellationToken)

Sample the datapoints from the asset and return the full serialized dataset.

Task<byte[]> SampleDatasetAsync(AssetDataset dataset, CancellationToken cancellationToken = default)

Parameters

dataset AssetDataset

The dataset of an asset to sample.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<byte[]>

The serialized payload containing the sampled dataset.

Remarks

This method will be invoked by the PollingTelemetryConnectorWorker each time that a dataset needs to be sampled. The worker service will then forward the returned serialized payload to the MQTT broker.