Class TelegramConsumer
Telegram Bot long-polling consumer.
Subscribes to bot.OnMessage and bot.OnUpdate events (Telegram.Bot v21+ API).
Each received update is wrapped in an IExchange and passed to the processor pipeline.
Long polling starts automatically when TelegramBotClient is created with a token.
Cancelled when DrainableConsumer signals stop via pollCt.
public sealed class TelegramConsumer : DrainableConsumer, IConsumer
Inheritance
Implements
Inherited Members
Properties
ConsumerEndpoint
The endpoint this consumer is attached to.
protected override IEndpoint ConsumerEndpoint { get; }
ConsumerName
Display name for logging (e.g. "kafka:orders", "file:/tmp/in").
protected override string ConsumerName { get; }
Methods
OnStarting(CancellationToken)
Called during Start() before RunAsync. Override for async setup (topology, subscriptions).
protected override Task OnStarting(CancellationToken ct)
OnStopAccepting()
Called at the beginning of Stop() before poll cancel. Override for protocol-level unsubscribe.
protected override Task OnStopAccepting()
OnStopped()
Called at the end of Stop() after CTS disposal. Override for resource cleanup.
protected override Task OnStopped()
RunAsync(CancellationToken, CancellationToken)
Main consumer loop. Receives pollCt (stop accepting new work)
protected override Task RunAsync(CancellationToken pollCt, CancellationToken processingCt)
Constructors
TelegramConsumer(TelegramEndpoint, IProcessor, TelegramEndpointOptions)
Creates a Telegram long-polling consumer.