[X] I have searched issues to ensure it has not already been reported
Description
IClusterConfigurationBuilder.OnStarted accepts an delegate to execute after the cluster manager loaded all consumers and their workers are starting.
It is a public API so it is available for use for both user customization and external libraries.
For example, KafkaFlow.Admin is using it to start the ITelemetryScheduler to periodically send telemetry to the admin.
This will not work if the user opted-in to the startup as well, or if 2 extensions require this hook. Only 1 will work.
Expected behavior
I belive this should behave like an event as it's misleading and hard to reason about.
As a side not, we should also consider:
1) Making it asyncable (via ValueTask ?)
2) Add resolution by introducing OnStarted in the builder for consumer creation so in the consumer builder we can handle the consumer creation and get the IConsumer.
Making the call async would cause a breaking change, we can evaluate this for version 4.0. Nevertheless, the invocation in these events should be brief, do you have any particular use case to make async calls here?
The Action already has a reference to the DependencyResolver, but the IConsumer instance is not available here, can you give an example why you need IConsumer here?
Prerequisites
Description
IClusterConfigurationBuilder.OnStarted
accepts an delegate to execute after the cluster manager loaded all consumers and their workers are starting.It is a public API so it is available for use for both user customization and external libraries.
For example,
KafkaFlow.Admin
is using it to start theITelemetryScheduler
to periodically send telemetry to the admin.This will not work if the user opted-in to the startup as well, or if 2 extensions require this hook. Only 1 will work.
Expected behavior
I belive this should behave like an event as it's misleading and hard to reason about.
As a side not, we should also consider:
1) Making it asyncable (via
ValueTask
?) 2) Add resolution by introducingOnStarted
in the builder for consumer creation so in the consumer builder we can handle the consumer creation and get theIConsumer
.KafkaFlow version
3.0.8
Thank you!