Chapter 10. Database integrations

 

This chapter covers

  • Publishing AMQP messages from PostgreSQL
  • Making RabbitMQ listen to PostgreSQL notifications
  • Using the InfluxDB storage exchange to store messages

Using RabbitMQ to decouple write operations against OLTP databases is a common way to achieve great data warehousing and event-stream processing techniques. When you publish messages with serialized data that will be written to the database, a simple consumer application can act as the bridge between events and your database. But it’s possible to skip the consumer step altogether and use a RabbitMQ plugin, such as the InfluxDB storage exchange, and automatically store messages in your database, directly from RabbitMQ.

The integration of RabbitMQ with an external database doesn’t stop there. Another powerful pattern is for your database to directly publish messages to RabbitMQ. This can be achieved by using extensions or plugins in the database, or by having a RabbitMQ plugin that acts as a database client, publishing messages whenever database events occur.

10.1. The pg_amqp PostgreSQL extension

10.2. Listening to PostgreSQL notifications

10.3. Storing messages in InfluxDB

10.4. Summary