Outbox Event Router
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. |
Change data capture on business tables tells consumers what changed in a table. During a migration that is often
exactly what you want: the anti-corruption layer reads legacy.BOOKSHOP.ORDERS and translates it into the new model.
But it also couples every consumer to the table layout. When a team wants to publish domain events instead, events
whose names and payloads form a contract that does not change when a column is renamed, it uses the transactional
outbox: the application writes the event as a row into an outbox table in the same transaction as the business
change, and Debezium turns each new outbox row into a message.
Why the outbox exists, the dual-write problem it removes, the polling publisher alternative and the idempotent
consumer are explained on Transactional
Outbox. How the router fits into Kafka Connect is outlined on
Kafka
Connect. This page does not repeat that material. It documents the Debezium side completely: the
io.debezium.transforms.outbox.EventRouter SMT and all of its options, its MongoDB counterpart, and the Debezium
Outbox Quarkus extension, with Bookshop examples for both the new Spring Boot application and the legacy Oracle
schema.
Checked on 2026-11-09 against Debezium 3.7.1.Final, Spring Boot 4.1.2 and the Debezium Outbox Quarkus extension 3.7.1.Final (built against Quarkus 3.33, Java 21). The Spring Boot outbox writer and the Quarkus event classes on this page were compiled (Spring Boot 4.1.2 with Java 21; the Quarkus classes against the extension’s API JAR); the connector configurations are derived from the official documentation and were not run against a live connector.
Outbox events in a migration
There are two places where an outbox helps a strangler-fig migration (see Migration Patterns with CDC):
-
In the new application. The Spring Boot
bookshopapplication owns more and more of the order life cycle. Other services, and eventually the legacy system through reverse replication, must learn about orders placed in the new system. PublishingOrderPlacedfrom an outbox gives them a stable contract instead of thepurchase_ordertable layout, which is still changing. -
In the legacy application, when you can change its code. Adding an outbox insert to the legacy order code produces events with business meaning (
OrderCancelled) that raw CDC onORDERScan only guess from aSTATUS_CDchange from'PD'to'CN'. If the legacy code cannot be changed, raw CDC plus an anti-corruption layer is the only option, which is why most of this section relies on it.
In both cases Debezium reads the outbox table from the transaction log, exactly as it reads any other table. The router SMT then turns the raw change event into a clean message: the topic comes from the aggregate type, the key from the aggregate id, and the value from the payload.
The outbox table
With the default configuration the router expects these columns:
| Column | Type (PostgreSQL) | Role in the emitted message |
|---|---|---|
|
|
The unique event id. It becomes the |
|
|
Replaces |
|
|
The message key. All events of one aggregate have the same key, land on the same partition and stay in order. Option
|
|
|
The event type ( |
|
|
The message value. Option |
Any other column can be added to the message as a header, as a field of an envelope, or used to choose the partition.
CREATE TABLE outbox_event (
id uuid NOT NULL PRIMARY KEY,
aggregatetype varchar(255) NOT NULL,
aggregateid varchar(255) NOT NULL,
type varchar(255) NOT NULL,
payload jsonb,
created_at timestamptz NOT NULL DEFAULT now()
);
Reference: Debezium — Basic outbox table
created_at is not used by the router. It lets you delete old rows and monitor the table. The router ignores
deletes on the outbox table, so you can delete rows at any time after they have been written to the log: in the same
transaction right after the insert (the Quarkus extension does this by default), or with a periodic
DELETE FROM outbox_event WHERE created_at < now() - interval '1 day'. Updating outbox rows, on the other hand, is
an error: the table is a queue, and table.op.invalid.behavior decides what happens.
Writing the outbox row from Spring Boot 4.1
The writer must insert the business rows and the outbox row in one local transaction. Nothing else is required: no
Kafka client, no retry logic. The service below places an order in the new model and records an OrderPlaced event.
It uses JdbcClient and the Jackson 3 JsonMapper that Spring Boot 4 configures, and casts the payload to jsonb.
package com.example.bookshop.orders;
import java.math.BigDecimal;
import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.util.List;
import java.util.UUID;
import org.springframework.jdbc.core.simple.JdbcClient;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tools.jackson.databind.json.JsonMapper;
@Service
public class PlaceOrderService {
public record Line(long bookId, int quantity, BigDecimal unitPrice) { }
/** The event payload: what consumers of outbox.event.Order receive as the record value. */
public record OrderPlaced(UUID orderId, UUID customerId, Instant placedAt, BigDecimal total, List<Line> lines) { }
private final JdbcClient jdbc;
private final JsonMapper jsonMapper;
public PlaceOrderService(JdbcClient jdbc, JsonMapper jsonMapper) {
this.jdbc = jdbc;
this.jsonMapper = jsonMapper;
}
@Transactional
public UUID placeOrder(UUID customerId, List<Line> lines) {
UUID orderId = UUID.randomUUID();
Instant placedAt = Instant.now();
BigDecimal total = lines.stream()
.map(l -> l.unitPrice().multiply(BigDecimal.valueOf(l.quantity())))
.reduce(BigDecimal.ZERO, BigDecimal::add);
// 1. The business write
jdbc.sql("""
INSERT INTO purchase_order (id, customer_id, placed_at, status, total)
VALUES (:id, :customerId, :placedAt, 'NEW', :total)""")
.param("id", orderId)
.param("customerId", customerId)
.param("placedAt", OffsetDateTime.ofInstant(placedAt, ZoneOffset.UTC))
.param("total", total)
.update();
int lineNo = 1;
for (Line line : lines) {
jdbc.sql("""
INSERT INTO order_line (order_id, line_no, book_id, quantity, unit_price)
VALUES (:orderId, :lineNo, :bookId, :quantity, :unitPrice)""")
.param("orderId", orderId)
.param("lineNo", lineNo++)
.param("bookId", line.bookId())
.param("quantity", line.quantity())
.param("unitPrice", line.unitPrice())
.update();
}
// 2. The event, in the same transaction: one commit, two tables
String payload = jsonMapper.writeValueAsString(
new OrderPlaced(orderId, customerId, placedAt, total, lines));
jdbc.sql("""
INSERT INTO outbox_event (id, aggregatetype, aggregateid, type, payload)
VALUES (:id, 'Order', :aggregateId, 'OrderPlaced', CAST(:payload AS jsonb))""")
.param("id", UUID.randomUUID())
.param("aggregateId", orderId.toString())
.param("payload", payload)
.update();
return orderId;
}
}
Reference: Debezium — Example outbox message
The class needs spring-boot-starter-jdbc, spring-boot-starter-jackson and the PostgreSQL driver. The aggregate
type Order decides the topic, and the order id is the key, so all events of one order stay in order on one
partition. The outbox page in the architecture section shows the same idea with JPA and an envelope with causation and
correlation ids; the router does not care which you use, only that the columns match its configuration.
The connector: capture only the outbox
Use a dedicated Debezium connector for the outbox table, separate from the reverse-replication connector
bookshop-pg-source. It has its own replication slot and publication, captures only public.outbox_event, and
applies the router to every record.
{
"name": "bookshop-pg-outbox",
"config": {
"connector.class": "io.debezium.connector.postgresql.PostgresConnector",
"tasks.max": "1",
"database.hostname": "postgres",
"database.port": "5432",
"database.user": "debezium",
"database.password": "dbz",
"database.dbname": "bookshop",
"topic.prefix": "modern-outbox",
"plugin.name": "pgoutput",
"slot.name": "bookshop_outbox",
"publication.name": "bookshop_outbox_pub",
"publication.autocreate.mode": "filtered",
"table.include.list": "public.outbox_event",
"snapshot.mode": "no_data",
"tombstones.on.delete": "false",
"key.converter": "org.apache.kafka.connect.storage.StringConverter",
"value.converter": "org.apache.kafka.connect.json.JsonConverter",
"value.converter.schemas.enable": "false",
"transforms": "outbox",
"transforms.outbox.type": "io.debezium.transforms.outbox.EventRouter",
"transforms.outbox.route.by.field": "aggregatetype",
"transforms.outbox.route.topic.replacement": "outbox.event.${routedByValue}",
"transforms.outbox.table.field.event.id": "id",
"transforms.outbox.table.field.event.key": "aggregateid",
"transforms.outbox.table.field.event.payload": "payload",
"transforms.outbox.table.expand.json.payload": "true",
"transforms.outbox.table.fields.additional.placement": "type:header:eventType",
"transforms.outbox.table.op.invalid.behavior": "error"
}
}
Choices worth explaining:
snapshot.mode=no_data-
An initial snapshot would read every row still in the outbox and publish it again. The outbox holds events, not state, so start streaming from the current position. (
no_datareplaced the deprecatedschema_only; see Initial Snapshots.) publication.autocreate.mode=filtered-
The publication contains only the captured table, so the slot does not decode changes of every other table. The PostgreSQL prerequisites (
wal_level=logical, the replication user) are on PostgreSQL Connector. tombstones.on.delete=false-
Deletes of outbox rows are cleanup, not events. The router filters delete events, and there is no reason to emit tombstones for them.
table.expand.json.payload=truewithJsonConverter-
The
jsonbpayload arrives as a JSON string. Expansion parses it and emits real JSON instead of an escaped string. If parsing fails, or the payload is empty, the content is kept as it is. key.converter=StringConverter-
The key is the
aggregateidstring. With the JSON converter it would be a quoted JSON string. table.fields.additional.placement-
Adds the
typecolumn as a header namedeventType, so consumers can choose a handler before parsing the value. table.op.invalid.behavior=error-
An
UPDATEon the outbox table is a bug in the writer.warn(the default) logs it,errorlogs an error, andfatalstops the connector. All three skip the update itself.
topic.prefix does not appear in the output topic names, because the router replaces the topic. It still names the
connector’s internal topics and metrics, so it must be unique on the Connect cluster.
The resulting message for the order placed above:
Topic: outbox.event.Order
Key: 5d1f6f36-7a59-4f3e-9b8e-2a1c0f0e4b11
Headers: id=0b8c4d3e-0f2a-4c66-8a1f-6e1d9c2b7a40, eventType=OrderPlaced
Value: {"orderId":"5d1f6f36-7a59-4f3e-9b8e-2a1c0f0e4b11","customerId":"8a6c1e4b-4c0d-4a51-9f1e-8f1b2c3d4e5f",
"placedAt":"2026-11-09T10:15:30.123Z","total":27.80,
"lines":[{"bookId":1001,"quantity":2,"unitPrice":13.90}]}
A consumer in the bookshop application, or in another service, reads outbox.event.Order like any Kafka topic, and
de-duplicates on the id header (at-least-once delivery means duplicates after a connector restart; see
Offsets, Restarts & Exactly-Once). The listener
side, including idempotency, is covered on Spring Boot and Kafka and
Listening to Events in Applications.
All EventRouter options
| Option | Default | Group | Description |
|---|---|---|---|
|
|
Table |
What to do when the outbox table receives an |
|
|
Table |
Column with the unique event id, emitted as the |
|
|
Table |
Column with the message key. |
|
none |
Table |
Column with the message timestamp. Without it, the Debezium event timestamp is used. |
|
|
Table |
Column with the payload. |
|
|
Table |
Parse a JSON string payload into a structure. Needs the |
|
|
Table |
With expansion, how a |
|
|
Table |
With expansion, how an empty array is handled: |
|
none |
Table, Envelope |
Extra columns as |
|
|
Table, Envelope |
When an additional column is missing: |
|
none |
Table, Schema |
Column whose value is used as the Kafka Connect schema version of the value. |
|
|
Router |
Column whose value becomes part of the topic name. |
|
|
Router |
Regular expression applied to the |
|
|
Router |
Destination topic, using the groups of
|
|
|
Router |
Emit a tombstone when the payload is empty or |
|
|
Tracing |
Column with the serialized tracing span context. |
|
|
Tracing |
Name of the span that represents Debezium’s processing. |
|
|
Tracing |
Trace only events that have a span context column. |
Topic names
route.topic.regex is matched against the value of the route.by.field column, and route.topic.replacement builds
the topic from its groups. The default regex captures the whole value in the named group routedByValue. To publish
Order events to bookshop.order.events (lower case is not possible with a regex replacement, so store the aggregate
type in the form you want, for example order):
transforms.outbox.route.by.field=aggregatetype
transforms.outbox.route.topic.regex=(?<routedByValue>.*)
transforms.outbox.route.topic.replacement=bookshop.${routedByValue}.events
Reference: Debezium — route.topic.replacement
route.topic.regex also restricts the SMT to matching values, which is one of the two ways the official page gives to
apply the router selectively; the other is a predicate (see
Debezium
Transformations). Use a predicate whenever the same connector captures tables other than the outbox.
Additional fields: headers, envelope and partition
table.fields.additional.placement takes column:placement:alias entries:
-
header: the column value becomes a Kafka header named after the alias (or the column). -
envelope: the message value becomes an envelope that containspayloadand the extra field, each as a separate field. Consumers must then readpayloadfrom inside the value. -
partition: the column value is the partition number. An alias has no effect. Use it only when the writer knows the partition count of the topic.
The table of options in the official documentation says that the placement must be header or envelope, while the
section on additional fields also documents partition. Test a partition placement on your version before you rely
on it.
transforms.outbox.table.fields.additional.placement=type:header:eventType,schema_version:header:schemaVersion,aggregatetype:envelope:aggregateType
transforms.outbox.table.field.additional.missing=error
This assumes an outbox table with a schema_version column. With table.field.additional.missing=error (the
default) a missing column fails the record, which is what you want during development.
Avro payloads
When the writer serializes the payload with Avro (for example with a schema registry serializer) and stores the bytes
in a binary column (bytea in PostgreSQL), the connector must pass the bytes through unchanged. Debezium’s
io.debezium.converters.BinaryDataConverter does that for the routed records, and delegates all other records
(heartbeats, schema change events) to another converter.
transforms=outbox
transforms.outbox.type=io.debezium.transforms.outbox.EventRouter
value.converter=io.debezium.converters.BinaryDataConverter
value.converter.delegate.converter.type=org.apache.kafka.connect.json.JsonConverter
value.converter.delegate.converter.type.schemas.enable=false
The official page also shows Apicurio Registry and Confluent Schema Registry AvroConverter delegates. Every setting
for the delegate needs the prefix value.converter.delegate.converter.type., the same prefix as the schemas.enable
line above. BinaryDataConverter passes the delegate only the keys under delegate.converter.type., with that prefix
removed (checked in the 3.7.1 class, not run). The official Apicurio example uses the shorter prefix
value.converter.delegate.converter., so its registry settings never reach the AvroConverter, and it writes the last
key as registry.find-latest instead of apicurio.registry.find-latest:
value.converter=io.debezium.converters.BinaryDataConverter
value.converter.delegate.converter.type=io.apicurio.registry.utils.converter.AvroConverter
value.converter.delegate.converter.type.apicurio.registry.url=http://apicurio:8080/apis/registry/v3
value.converter.delegate.converter.type.apicurio.registry.auto-register=true
value.converter.delegate.converter.type.apicurio.registry.find-latest=true
apicurio:8080 is the registry’s host name inside the Docker network; from the host it is http://localhost:8080.
The Apicurio converter classes are not in the plain connector archive; the Debezium Connect image adds them with
ENABLE_APICURIO_CONVERTERS=true. The URL uses the Apicurio Registry 3.x path /apis/registry/v3, where the official
example shows the older /apis/registry/v2. Registry versions and API paths are covered on
Serialization & Schema Registries.
An outbox in the legacy Oracle schema
If the legacy order code can be changed, an outbox table in the BOOKSHOP schema lets it publish real domain events.
Oracle has no jsonb, and unquoted Oracle identifiers are upper case, which changes the configuration in two ways:
the payload is text, and every column option must name the upper-case column.
CREATE TABLE BOOKSHOP.OUTBOX_EVENT (
ID VARCHAR2(36) NOT NULL PRIMARY KEY,
AGGREGATETYPE VARCHAR2(255) NOT NULL,
AGGREGATEID VARCHAR2(255) NOT NULL,
TYPE VARCHAR2(255) NOT NULL,
PAYLOAD VARCHAR2(4000),
CREATED_AT TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL
);
ALTER TABLE BOOKSHOP.OUTBOX_EVENT ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
-- In the legacy order code, inside the same transaction as the UPDATE of ORDERS:
INSERT INTO BOOKSHOP.OUTBOX_EVENT (ID, AGGREGATETYPE, AGGREGATEID, TYPE, PAYLOAD)
VALUES (:eventId, 'LegacyOrder', TO_CHAR(:orderId), 'OrderCancelled',
'{"orderId":' || TO_CHAR(:orderId) || ',"reason":"customer request"}');
{
"table.include.list": "BOOKSHOP.OUTBOX_EVENT",
"transforms": "outbox",
"transforms.outbox.type": "io.debezium.transforms.outbox.EventRouter",
"transforms.outbox.table.field.event.id": "ID",
"transforms.outbox.table.field.event.key": "AGGREGATEID",
"transforms.outbox.table.field.event.payload": "PAYLOAD",
"transforms.outbox.route.by.field": "AGGREGATETYPE",
"transforms.outbox.route.topic.replacement": "outbox.event.${routedByValue}",
"transforms.outbox.table.expand.json.payload": "true",
"transforms.outbox.table.fields.additional.placement": "TYPE:header:eventType",
"value.converter": "org.apache.kafka.connect.json.JsonConverter",
"value.converter.schemas.enable": "false"
}
These keys belong to a separate Oracle connector (for example bookshop-oracle-outbox, with its own topic.prefix
and schema history topic) next to bookshop-oracle-source. Adding the router to bookshop-oracle-source would apply it
to every captured table unless you add a predicate, and the raw events of BOOK or ORDERS are not outbox rows. The
rest of the Oracle configuration (LogMiner, C##DBZUSER, database.pdb.name=FREEPDB1) is on
Oracle Connector.
A VARCHAR2(4000) payload keeps the example free of LOBs. A CLOB payload needs lob.enabled=true on the Oracle
connector, with the caveats about LOB handling described on the Oracle page and in
Custom Converters & Post Processors.
PostgreSQL: an outbox without a table
PostgreSQL can write a message directly into the WAL with pg_logical_emit_message(), without any table. The
PostgreSQL connector emits such messages as events with op: "m", and the DecodeLogicalDecodingMessageContent SMT
turns their binary content into an insert-like event that the outbox router can process. Chain the two SMTs, decode
first. Because no row is ever stored, there is nothing to clean up, but the message is only as durable as the WAL and
the replication slot. The message events and the prefix filters are documented on
PostgreSQL Connector, and the decoding SMT on
Debezium
Transformations.
MongoDB: the MongoDB outbox event router
The relational router does not work with the MongoDB connector. For MongoDB, Debezium provides
io.debezium.connector.mongodb.transforms.outbox.MongoEventRouter, which reads an outbox collection. The writer must
modify the business collection and insert the outbox document in one multi-document transaction (MongoDB 4.0 or
later, on a replica set or sharded cluster). The expected document has the fields _id (ObjectId),
aggregateid (ObjectId), aggregatetype, type and payload.
collection.include.list=bookshop.outbox
transforms=outbox
transforms.outbox.type=io.debezium.connector.mongodb.transforms.outbox.MongoEventRouter
transforms.outbox.collection.expand.json.payload=true
transforms.outbox.collection.fields.additional.placement=type:header:eventType
transforms.outbox.route.topic.replacement=outbox.event.${routedByValue}
value.converter=org.apache.kafka.connect.json.JsonConverter
value.converter.schemas.enable=false
The options mirror the relational ones with collection. in place of table.: collection.op.invalid.behavior,
collection.field.event.id (default _id), collection.field.event.key (default aggregateid),
collection.field.event.timestamp, collection.field.event.payload (default payload),
collection.expand.json.payload, collection.fields.additional.placement, collection.field.additional.missing
and collection.field.event.schema.version. The route.* and tracing.* options are the same as for the relational
router.
The Debezium Outbox Quarkus extension
For Quarkus applications Debezium provides an extension that creates the outbox table and writes outbox rows for you.
The application fires a CDI event that implements io.debezium.outbox.quarkus.ExportedEvent, and the extension
persists it with Hibernate ORM inside the current transaction. The defaults of the extension match the defaults of the
router, so the connector configuration above only needs the table name.
Version facts, checked on 2026-11-09:
-
Artifact
io.debezium:debezium-quarkus-outbox:3.7.1.Final, andio.debezium:debezium-quarkus-outbox-reactive:3.7.1.Finalfor Hibernate Reactive. -
The Debezium 3.7 release page lists Java 21+ for the Outbox and Quarkus extensions (connectors need Java 17+). The extension’s build sets the Java release to 21.
-
Debezium 3.7.1.Final builds the extension against Quarkus 3.33 (
quarkus.version3.33.1.1 in its parent POM). The current Quarkus release is 3.40.1 and Quarkus 4.0 is in beta. Align your Quarkus platform with a version the extension supports, and test before you move to a newer major Quarkus release.
<dependency>
<groupId>io.debezium</groupId>
<artifactId>debezium-quarkus-outbox</artifactId>
<version>3.7.1.Final</version>
</dependency>
An OrderPlaced event for a Quarkus version of the order service. The type parameters are the aggregate id type and
the payload type; every ExportedEvent implementation in one application must use the same ones, because they share
one table.
package com.example.bookshop.orders;
import java.math.BigDecimal;
import java.time.Instant;
import java.util.Map;
import java.util.UUID;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.debezium.outbox.quarkus.ExportedEvent;
public class OrderPlacedEvent implements ExportedEvent<String, JsonNode> {
private static final ObjectMapper MAPPER = new ObjectMapper();
private final UUID orderId;
private final JsonNode payload;
private final Instant timestamp;
public OrderPlacedEvent(UUID orderId, UUID customerId, BigDecimal total, Instant placedAt) {
this.orderId = orderId;
this.timestamp = placedAt;
ObjectNode node = MAPPER.createObjectNode();
node.put("orderId", orderId.toString());
node.put("customerId", customerId.toString());
node.put("total", total);
node.put("placedAt", placedAt.toString());
this.payload = node;
}
@Override
public String getAggregateId() {
return orderId.toString(); // becomes the Kafka record key
}
@Override
public String getAggregateType() {
return "Order"; // becomes the topic suffix: outbox.event.Order
}
@Override
public String getType() {
return "OrderPlaced";
}
@Override
public Instant getTimestamp() {
return timestamp;
}
@Override
public JsonNode getPayload() {
return payload;
}
@Override
public Map<String, Object> getAdditionalFieldValues() {
return Map.of();
}
}
Reference: Debezium — Outbox Quarkus extension, example
package com.example.bookshop.orders;
import java.math.BigDecimal;
import java.time.Instant;
import java.util.UUID;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.event.Event;
import jakarta.inject.Inject;
import jakarta.persistence.EntityManager;
import jakarta.transaction.Transactional;
import io.debezium.outbox.quarkus.ExportedEvent;
@ApplicationScoped
public class OrderService {
@Inject
EntityManager entityManager;
@Inject
Event<ExportedEvent<?, ?>> event;
@Transactional
public UUID placeOrder(UUID customerId, BigDecimal total) {
UUID orderId = UUID.randomUUID();
Instant placedAt = Instant.now();
entityManager.createNativeQuery("""
INSERT INTO purchase_order (id, customer_id, placed_at, status, total)
VALUES (?1, ?2, ?3, 'NEW', ?4)""")
.setParameter(1, orderId)
.setParameter(2, customerId)
.setParameter(3, placedAt)
.setParameter(4, total)
.executeUpdate();
// The extension writes the outbox row in this same transaction
event.fire(new OrderPlacedEvent(orderId, customerId, total, placedAt));
return orderId;
}
}
Reference: Debezium — Outbox Quarkus extension, example
The official page still names javax.enterprise.event.Event in its prose; current Quarkus versions use the
jakarta.* namespace, as above. The reactive variant provides a DebeziumOutboxHandler bean whose
persistToOutbox(event) returns a Mutiny Uni that must be subscribed to, inside a @ReactiveTransactional method.
Extension configuration
The build-time properties name the table and its columns; change them only together with the router options.
# Build time: table and columns (the values shown are the defaults)
quarkus.debezium-outbox.table-name=OutboxEvent
quarkus.debezium-outbox.id.name=id
quarkus.debezium-outbox.aggregate-id.name=aggregateid
quarkus.debezium-outbox.aggregate-type.name=aggregatetype
quarkus.debezium-outbox.type.name=type
quarkus.debezium-outbox.timestamp.name=timestamp
quarkus.debezium-outbox.payload.name=payload
quarkus.debezium-outbox.payload.column-definition=VARCHAR(8000)
# Extra column, set from ExportedEvent#getAdditionalFieldValues()
quarkus.debezium-outbox.additional-fields=customer_name:string:varchar(100)
# Runtime: delete the row right after inserting it (default true); Debezium still sees the insert in the log
quarkus.debezium-outbox.remove-after-insert=true
The full list of build-time properties also covers each column’s column-definition and JPA converter,
payload.type (a Hibernate user type), the tracing span column (tracing-span.name, default tracingspancontext) and
additional-fields, whose entries have the form
<field-name>:<field-java-type>[:<field-column-definition>[:<field-jpa-attribute-converter>]].
On PostgreSQL, Hibernate creates the default table name OutboxEvent unquoted, so the database name is
outboxevent. The matching connector needs "table.include.list": "public.outboxevent". The payload column is
VARCHAR(8000) by default, so keep table.expand.json.payload=true on the router to emit real JSON. Every
additional-fields column you want in the message must also appear in table.fields.additional.placement, and with
table.field.additional.missing=error the router fails if it does not.
What goes wrong
| Symptom | Cause and fix |
|---|---|
Old events are published again after the connector is created or reset |
The initial snapshot read the rows still in the outbox. Use |
Raw change events for business tables appear on |
The connector captures more than the outbox, and the router has no predicate. Restrict |
Warnings about |
Writer code updates outbox rows (for example to mark them as sent, a habit from a polling publisher). Remove the update; with CDC there is nothing to mark. |
Events of one order arrive out of order |
The key is not the aggregate id (wrong |
Consumers see an escaped JSON string |
|
Duplicate events after a restart |
Expected with at-least-once delivery. De-duplicate on the |
The outbox table grows without limit |
Nothing deletes processed rows. Delete in the same transaction (as the Quarkus extension does) or periodically. |
Verifying an outbox pipeline
-
Call the writer (place an order) and check in PostgreSQL that the outbox row was committed with the order:
SELECT id, aggregatetype, aggregateid, type FROM outbox_event ORDER BY created_at DESC LIMIT 1; -
Check the connector:
GET http://localhost:8083/connectors/bookshop-pg-outbox/statusmust show the connector and its task asRUNNING. -
Read the topic with keys and headers, and compare the
idheader with the outbox row id. -
Roll back a transaction on purpose (for example, throw after the outbox insert in a test) and confirm that no message appears.
-
Delete the outbox row and confirm that nothing new is published.
kafka-console-consumer.sh --bootstrap-server localhost:9092 \
--topic outbox.event.Order --from-beginning \
--formatter-property print.key=true --formatter-property print.headers=true
Reference: Apache Kafka 4.3 — Basic Kafka operations
An automated version of these checks, with Testcontainers, is on Testing CDC Pipelines.