Kafka Events
The underlying library (Confluent.Kafka) uses some events to let you catch important information, interact with the partitions assignment process, etc.
Silverback proxies those events to give you full access to those features.
Consumer events
These callbacks are available:
- IKafkaPartitionsAssignedCallback
- IKafkaPartitionsRevokedCallback
- IKafkaOffsetCommittedCallback
- IKafkaConsumerErrorCallback
- IKafkaConsumerStatisticsCallback
- IKafkaConsumerLogCallback
- IKafkaPartitionEofCallback
Offset reset example
In the following example the partitions assigned event is subscribed in order to reset the start offsets and replay the past messages.
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services
.AddSilverback()
.WithConnectionToMessageBroker(options => options
.AddKafka())
.AddSingletonBrokerCallbackHandler<ResetOffsetPartitionsAssignedCallbackHandler>();
}
}
Producer events
These callbacks are available: