Skip to content

Instantly share code, notes, and snippets.

@ProcessEight
Last active May 20, 2024 11:15
Show Gist options
  • Save ProcessEight/0ce2695817fde5586c99603757b7e9b0 to your computer and use it in GitHub Desktop.
Save ProcessEight/0ce2695817fde5586c99603757b7e9b0 to your computer and use it in GitHub Desktop.
Research into RabbitMQ

RabbitMQ

Key concepts

AMQP: Advanced Message Queueing Protocol: A set of rules which govern how messages are exchanged between systems and processed.

Message: A piece of data which needs to be processed in some way

Queue: A buffer which temporarily holds messages. A queue processes messages one-by-one, in a FIFO order.

Producer: An entity which produces messages, then sends them to a queue or to an exchange.

Exchange: An exchange routes messages to one or more queues. AMQP defines four types of exchanges; Magento uses the topic type of exchange.

Topic: IN Magento, queues are organised into groups called 'topics'. Messages are tagged with a topic so the exchange passes them to the correct queue. A topic is also a way for subscribers to listen to the topics in which they are interested.

Routing rules: Message queues that use exchanges and topics employ 'routing rules' to determine which messages are routed to which queue. Magento uses routing rules based on topic names and wildcard pattern matching. Exchanges route messages by matching the routing key to the routing pattern, as defined in the binding.

Binding: Connects an exchange to a topic queue and defines the routing rules which determine how the exchange routes the message to the topic queue.

Consumer: Consumes messages from a queue and processes them, or passes them to another process (e.g. A program) to be processed. The consumer is typically a long-run process that consumes messages for as long when there are messages in the queue. The consumer can also start consuming messages by polling a queue at intervals to see if there are messages to process or by being told to by other events, such as a cron job.

Note that RabbitMQ typically listens on port 5672. RabbitMQ's web interface can be accessed by prefixing this with a 1, i.e 15672.

$ sudo service rabbitmq-server start
Failed to start rabbitmq-server.service: Unit rabbitmq-server.service is masked.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment