This single message transformation (SMT) is under active development right now, so the emitted message structure or other details may still change as development progresses.
====
[NOTE]
====
This SMT does *not* support the MongoDB connector.
====
The Outbox Event Router SMT has the intent to provide out-of-the-box support for the Outbox Pattern.
For more information on why and how the Outbox Pattern is used please refer our blog post link:/blog/2019/02/19/reliable-microservices-data-exchange-with-the-outbox-pattern/[Reliable Microservices Data Exchange With the Outbox Pattern].
A working example can also be found at our https://github.com/debezium/debezium-examples[Examples Repository] in the https://github.com/debezium/debezium-examples/tree/master/outbox[`outbox` directory].
== Example
In order to understand the configuration and terms used in this SMT, let's look into its parts with the given expected outbox message:
This result was achieved with the {link-prefix}:{link-outbox-event-router}#outbox-event-router-configuration-options[default configuration] which assumes a table structure and event routing based on aggregates. In case you want a custom behavior, the SMT is fully configurable, check the {link-prefix}:{link-outbox-event-router}#outbox-event-router-configuration-options[available configuration options].
|Optionally you can override the Kafka message timestamp with a value from a chosen field, otherwise it'll be the {prodname} event processed timestamp.
|Extra fields can be added as part of the event envelope or as message header; the format is a list of colon-delimited pairs or trios when you desire to have aliases, e.g. `id:header,field_name:envelope:alias`. Placement options are `header` and `envelope`.
|When set, it'll be used as schema version as in the https://kafka.apache.org/20/javadoc/org/apache/kafka/connect/data/ConnectSchema.html#version--[Kafka Connect Schema] javadoc
|The default regex to use within the RegexRouter, the default capture will allow to replace the routed field into a new topic name defined in `route.topic.replacement`
|The name of the topic in which the events will be routed, a replacement `pass:[${routedByValue}]` is available which is the value of The column configured via `route.by.field`
|While {prodname} is monitoring the table, it's not expecting to see 'update' row events, in case it happens, this transform can log it as warning, error or stop the process. Options are `warn`, `error` and `fatal`
|Is the default field for the routing, it gets append to the topic name (check configuration <<outbox-event-router-property-route-topic-replacement, `route.topic.replacement`>>)
|Becomes the Kafka message key, which is important for keeping ordering within Kafka partitions
|`payload`
|The JSON representation of the event itself, becomes either part of the message as `payload` or if other metadata including `eventType` are delivered as headers then the payload becomes the message itself without an encapsulation in an envelope
The outbox table may contain additional columns that need to be included in the emitted Kafka message.
Suppose the table contains an `eventType` column that indicates the type a given event is (e.g. for events of the "purchase order" aggregate type, there might be event types like "order created", "order shipped", etc.).