Skip to main content

Why this matters


Published events let your systems react to a transaction the moment it happens. You can trigger customer notifications, sync your ERP, feed analytics dashboards, or start compliance workflows. Your systems stay loosely coupled. The sections below cover the technical setup. For a business overview, see About Midaz.

Enabling transaction events


Midaz publishes transaction events by default. It treats the flag as enabled unless you set it to false. The bundled example configuration ships the flag set to false. On a stack that starts from that example, set the flag to true in the transaction application:
With the flag enabled, Midaz publishes events to this RabbitMQ exchange:

Event types


Midaz emits one of these event types, based on the transaction lifecycle stage:

Example event payload


The full payload includes timestamps, balance snapshots, and other identifiers. You use these for audit and traceability.

Event routing model


Midaz uses a topic exchange to publish messages. It does not send messages directly to specific queues. You control which events you receive with your own bindings.

How routing works

Midaz tags each event with a routingKey. The routingKey uses this format:
The <status> value is the current transaction status: APPROVED, PENDING, CANCELED, CREATED, or NOTED. To consume events, your application must:
1
Create a queue in RabbitMQ.
2
Bind your queue to the Midaz exchange with a routingKey pattern for the events you want.

Visual overview

Midaz event routing model, showing how published events reach subscriber queues bound to the exchange by routing-key patterns

Figure 1. Visual representation of the event routing model.

You can configure multiple queues with different bindings to serve specific teams or services independently.

Queue and binding example


Creating a new queue

Binding the queue to receive all events

The wildcard * matches all five statuses: APPROVED, PENDING, CANCELED, CREATED, and NOTED. To subscribe to one event type, replace the wildcard with the exact status. For example, midaz.transaction.NOTED receives only annotation events.
Midaz does not manage or create RabbitMQ queues for you. You must provision the queues and set up the correct bindings.