AMQP Networks with Style RPC

See also section AMQP Connections.

Here is a little more detail on the dynamics of the AMQP style RPC. In this special example, we show Lobster_data as producer and consumer. This is done to show special settings in the Input Agent AMQP (see there) and the Response Route AMQP (see there) that have to be considered for style RPC. This also provides a relatively convenient way to test. In the 'real' world, Lobster_data will often only appear as either producer or consumer, so do not let that confuse you. In addition, we would simply like to show in general how networks of this type can be constructed.

Note: You could also, of course, build an architecture as described below with internal Lobster_data messages (Response Route Message, Input Agent Message). This is faster and also saves you from using external AMQP servers.


images/download/attachments/177902865/AMQP_Netz_EN-version-1-modificationdate-1719385758315-api-v2.png


(1) If you send a message via style RPC to an AMQP server (here with a profile with a Response Route AMQP) to a specific queue (here xyz), Lobster_data internally (you do not have to do this explicitly) requests a (unique) temporary queue (the name, here abc, is assigned automatically and cannot be influenced), which it then 'listens' to until a message appears (the RPC response). In addition, a correlation ID is assigned (also internally), which is used to identify the correct response. So if you send an RPC request message with correlation ID 1, you will wait for an RPC response message with correlation ID 1.

(2) A profile with Input Agent AMQP consumes the message from queue xyz. In the profile, you then generate the RPC response. After that, you have to use the custom class PassBackDataResponse in a Response Route. This class sends the RPC response message back to the AMQP server onto the temporary queue abc. See also (3).

(3) Profile (1) now consumes the message from (2) (so the RPC response message on queue abc and correlation ID 1). Note: The correlation ID has to be identical.

(4) Since the Response Route AMQP cannot process the response from (3) itself, it is forwarded to a subsequent profile (with Input Agent Message) to be processed there.


Note: Technical details (for RabbitMQ), whose knowledge we need to presuppose to a certain extent here, can also be found here, here and here (for RabbitMQ).