Pub-Sub (Publish-Subscribe)
Publish-subscribe (pub-sub) is a messaging pattern where publishers emit events to a central broker without knowing who will receive them, and subscribers register interest in specific event types and receive matching events asynchronously.
Understanding Pub-Sub (Publish-Subscribe)
Pub-sub decouples the sender of a message (publisher) from its receivers (subscribers). Publishers emit events without knowing or caring which subscribers are interested. Subscribers register for event types they care about and receive relevant events without needing to poll or maintain direct connections to publishers. This decoupling makes systems easier to extend: adding a new subscriber to handle a new use case requires no changes to publishers or existing subscribers. Message brokers like RabbitMQ, Apache Kafka, and Google Cloud Pub/Sub implement this pattern at scale.
How GAIA Uses Pub-Sub (Publish-Subscribe)
GAIA uses pub-sub messaging through RabbitMQ to coordinate its agent workflows. When an email arrives, the email intake service publishes an event to the broker.
Related Concepts
Event-Driven Architecture
Event-driven architecture (EDA) is a software design pattern where system components communicate through events — discrete notifications that something has happened — enabling loose coupling, real-time responsiveness, and scalable reactive systems.
Message Queue
A message queue is a system that stores messages (tasks or events) sent from producers and delivers them to consumers for processing, decoupling the two and enabling asynchronous, reliable communication between system components.
Webhook
A webhook is an HTTP callback mechanism where a system sends an automated HTTP request to a specified URL whenever a defined event occurs, enabling real-time notification and integration between services without polling.
Event-Driven Automation
Event-driven automation (also called event-based automation) runs a workflow the moment something happens, such as a new email arriving, an issue being created or a row being added to a spreadsheet, instead of at a fixed time. Each automation pairs a trigger event with the actions to take, and the system where the event happened notifies the automation platform, usually through a webhook.
