Feature: Broker event handlers
Is your feature request related to a problem? Please describe. If multiple brokers are used user might need to stop processing messages if depends on other broker,
Describe the solution you'd like Handle connected/disconnected/reconnected events. Probably, multiple FastStream app instances might be instantiated. As i understand, other brokers that not referred by any FastStream app are not re-connecting automatically in case of network failures or something else. Probably reconnect feature could be enabled for a broker that not referenced by any app.
Feature code example
from faststream import FastStream
kafka_broker = KafkaBroker(bootstrap_servers= "127.0.0.1:9092")
rabbit_broker = RabbitBroker("amqp://127.0.0.1:5672", virtualhost="/")
@kafka_broker.on_disconnect
async def kafka_disconnected_cb():
pass
@rabbit_broker.on_disconnect
async def rabbit_disconnected_cb():
pass
...
ref1: https://github.com/airtai/faststream/issues/526
All our running brokers should reconnect automatically. But, adding special hooks to check it is a great point, thank your for the idea!
@Lancetnik I would like to work on this if this issue is still available. Let me know and I will start working on a PR
@Lancetnik I would like to work on this if this issue is still available. Let me know and I will start working on a PR
I can even assign it to you 😄
I need something similar but for RabbitMQ