RPC over RMQ#
FastStream provides you with the ability to send a blocking RPC request over RabbitMQ in a very simple way.
It uses the Direct Reply-To RabbitMQ feature, so you don't need to create any queues to consume a response.
Just send a message like a regular one and get a response synchronously.
It is very close to common requests syntax:
Also, you have two extra options to control this behavior:
rpc_timeout: Optional[float] = 30.0- controls how long you are waiting for a response
raise_timeout: bool = False- by default, a timeout request returns
None, but if you need to raise a
TimeoutExceptiondirectly, you can specify this option
Also, if you want to create a permanent request-reply data flow, probably, you should create a permanent queue to consume responses.
So, if you have such one, you can specify it with the
reply_to argument. This way, FastStream will send a response to this queue automatically.