-
Hi all, I'm evaluating this library for a tech spike (I'm really impressed with the usability so far) and I just wanted to confirm if some behaviour is intended with the RabbitMQ client or whether I'm calling something incorrectly. When declaring a subscriber like: @broker.subscriber("test", "test")
async def handler():
logger.info("received message") The client seems to automatically create the specified exchange and queue. However doing the same with a publisher like: @broker.publisher("test", "test")
async def handler():
logger.info("send message") No exchange and queues are automatically created. I've also noticed that even when manually declaring a queue/exchange with Happy to create an issue if this is indeed a bug but just thought I'd confirm first. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Hi! You can setup routing key as a field of RabbitQueue/Exchange object, but it has no sense for 'declare' method calling |
Beta Was this translation helpful? Give feedback.
-
@bnugent2 So, you can manually declare any queue/exchange in your from faststream import FastStream
from faststream.rabbit import RabbitBroker, RabbitExchange, RabbitQueue
broker = RabbitBroker()
app = FastStream(broker)
@app.after_startup
async def declare():
queue = await broker.declare_queue(RabbitQueue("test"))
exchange = await broker.declare_exchange(RabbitExchange("test"))
await queue.bind(
exchange,
routing_key="custom-key",
) Also, with the |
Beta Was this translation helpful? Give feedback.
@bnugent2 So, you can manually declare any queue/exchange in your
on_startup
event and bind them each otherAlso, with the
0.2.9
release, publishers will automatically register exchanges (but not queue) too