Worker¶
Namespace: MQTT_Receiver_Worker
Background worker service for handling MQTT message receiving operations.
Implements a long-running service that subscribes to MQTT topics and processes messages.
public class Worker : Microsoft.Extensions.Hosting.BackgroundService, Microsoft.Extensions.Hosting.IHostedService, System.IDisposable
Inheritance Object → BackgroundService → Worker
Implements IHostedService, IDisposable
Properties¶
ExecuteTask¶
Property Value¶
Constructors¶
Worker(ILogger<Worker>, IReceiver, IConnection)¶
Initializes a new instance of the Worker class.
Parameters¶
logger ILogger<Worker>
Logger for recording service events.
receiver IReceiver
MQTT receiver for subscribing to topics.
connection IConnection
Connection that handles broker connectivity
Methods¶
ExecuteAsync(CancellationToken)¶
Executes the worker process, maintaining MQTT connection and subscribing to topics.
This is the main entry point for the background service execution.
Parameters¶
stoppingToken CancellationToken
Token that can be used to request cancellation of the operation.
Returns¶
A task representing the asynchronous operation.