'RabbitMQ - who is responsible on sending a message to the correct handler?

From RabbitMQ docs:

"Applications can subscribe to have RabbitMQ push enqueued messages (deliveries) to them. This is done by registering a consumer (subscription) on a queue. After a subscription is in place, RabbitMQ will begin delivering messages. For each delivery, a user-provided handler will be invoked"

Once rabbit sends a message to the application, who is dealing with the logic of deciding which handler function was used in the subscription process, and calling that handler?

Is it info stored as part of the message? Or is it something the application is in charge of and not rabbit? Was looking online, but couldn't find a detailed explanation of what is actually going on.

For example - if an application subscribed to a queue named X, with a handler function named "do_something". Then the application restarts, and when we run the application again, it connects to the rabbit client, but this time it doesn't subscribe. Will messages that were sent to queue X still be handled by "do_something", because we subscribed before? or nothing will happen because of the restart?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source