Architecture Components

Write-Ahead Log (WAL)

Logical Decoding

Replication Slots

Logical Decoding Plugins

Queue

  • Essentially a set of tables in a PostgreSQL database.
  • Default is to have 3 tables per queue, these are rotated to efficiently purge discarded events.
  • Event is discarded when all the consumers have processed it.
  • There can be multiple queues in one database.
  • Any number of producers and consumers to the queue.

Producer

  • application module that pushes transactions into queue.

Consumer

  • application that reads transactions from queue.

Architecture Pillar

Features

  • Transactional. Events are created transactionally, can be coupled with surrounding business logic.
  • Efficient. Events are processed in batches which gives low per event overhead.
  • Flexible. No limits on the number of producers or consumers. Custom event formats.
  • Reliable. Events are stored in PostgreSQL database – this adds the benefit of write ahead logging and crash recovery.
  • Easy to use. Simple SQL interface, API-s for several languages.
  • Open Source. No licensing fees, but occasionally you’ll have to get your hands dirty

Replication Metadata (publications and subscriptions) hosted and managed outside of database

Benefits of queuing

  • client can send a request to an unavailable server
  • server can send a reply to an unavailable client
  • can have many servers feed off a single queue