Skip to content

RabbitMQ

The official "hello-world" example for python on RabbitMQ's homepage describes a message broker in the following way:

RabbitMQ is a message broker: it accepts and forwards messages. You can think about it as a post office: when you put the mail that you want posting in a post box, you can be sure that Mr. or Ms. Mailperson will eventually deliver the mail to your recipient. In this analogy, RabbitMQ is a post box, a post office and a postman.

The major difference between RabbitMQ and the post office is that it doesn't deal with paper, instead it accepts, stores and forwards binary blobs of data ‒ messages.

For every registered application in Lime CRM, there is a message queue (or a post box) in RabbitMQ.

Every time an object is created, updated or deleted in the platform, a message is sent to that application's message queue.

Configuration

Communication to RabbitMQ goes through the AMQP protocol over port 5672.

Any service (e.g. Event Handler, Task Handler, Web Server) publishing to RabbitMQ can be configured as:

events:
    connection_string: amqp://guest@localhost//
    tcp_keepalive_timeout: 120

Services (Event Handler) consuming events from RabbitMQ can be configured as:

events:
    connection_string: amqp://guest@localhost//
    consumer_heartbeat: 15
    tcp_keepalive_timeout: 120

connection_string

The connection string to the RabbitMQ installation.

consumer_heartbeat

This option is used to define the heartbeat, in seconds, of consumer connections.

Heartbeats can be used to ensure the connection between RabbitMQ and event consumers are alive and well.

If RabbitMQ doesn't receive a heartbeat over AMQP within a specified period of time it will assume the consumer is offline or has encountered and error.

Use this setting when encountering unexpected connection losses in the event handler.

tcp_keepalive_timeout

This option defines the duration of time, in seconds, for which TCP keepalive packets are sent to client machines in order to keep a connection alive. It means that the server basically asks the client to send a sign of life in order for the server to know whether this connection is healthy (alive) or not.

This value should be assigned a value that is less than the connection timeout value of firewalls or proxies that might terminate a connection.

Similar to consumer_heartbeat this option can be used to adjust the period used to make sure connections are kept alive between RabbitMQ and services publishing events or celery tasks.