<commit_before>:page-aliases: configuration/outbox-event-router.adoc
// Category: debezium-using
// Type: assembly
// ModuleID: configuring-debezium-connectors-to-use-the-outbox-pattern
// Title: Configuring {prodname} connectors to use the outbox pattern
[id="outbox-event-router"]
= Outbox Event Router

:toc:
:toc-placement: macro
:linkattrs:
:icons: font
:source-highlighter: highlight.js

toc::[]

The outbox pattern is a way to safely and reliably exchange data between multiple (micro) services. An outbox pattern implementation avoids inconsistencies between a service's internal state (as typically persisted in its database) and state in events consumed by services that need the same data.

To implement the outbox pattern in a {prodname} application, configure a {prodname} connector to:

* Capture changes in an outbox table
* Apply the {prodname} outbox event router single message transformation (SMT)

A {prodname} connector that is configured to apply the outbox SMT should capture changes that occur in an outbox table only.
For more information, see xref:options-for-applying-the-transformation-selectively[Options for applying the transformation selectively].

A connector can capture changes in more than one outbox table only if each outbox table has the same structure.
ifdef::product[]
[IMPORTANT]
====
The outbox event router SMT is a Technology Preview feature only.
Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete.
Red Hat does not recommend using them in production.
These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see link:https://access.redhat.com/support/offerings/techpreview[https://access.redhat.com/support/offerings/techpreview].
====
endif::product[]
See link:https://debezium.io/blog/2019/02/19/reliable-microservices-data-exchange-with-the-outbox-pattern/[Reliable Microservices Data Exchange With the Outbox Pattern] to learn about why the outbox pattern is useful and how it works.

ifdef::community[]
For an example that you can run, see the  link:https://github.com/debezium/debezium-examples/tree/main/outbox[outbox pattern demo], which is in the {prodname} examples repository. It includes an example of how to configure a {prodname} connector to run the outbox event router SMT.
endif::community[]

[NOTE]
====
This SMT does *not* support the MongoDB connector;
please use the xref:transformations/mongodb-outbox-event-router.adoc[MongoDB outbox event router] SMT with that connector.
====

ifdef::product[]
The following topics provide details:

* xref:example-of-a-debezium-outbox-message[]
* xref:outbox-table-structure-expected-by-debezium-outbox-event-router-smt[]
* xref:basic-debezium-outbox-event-router-smt-configuration[]
* xref:options-for-applying-the-outbox-event-router-transformation-selectively[]
* xref:using-avro-as-the-payload-format-in-debezium-outbox-messages[]
* xref:emitting-additional-fields-in-debezium-outbox-messages[]
* xref:emitting-additional-fields-in-debezium-outbox-messages[]
* xref:expanding-escaped-json-string-as-json[]
* xref:options-for-configuring-outbox-event-router-transformation[]
endif::product[]

// Type: concept
// ModuleID: example-of-a-debezium-outbox-message
// Title: Example of a {prodname} outbox message
[[example-outbox-message]]
== Example outbox message

To learn about how to configure the {prodname} outbox event router SMT, consider the following example of a {prodname} outbox message:

[source,javascript,indent=0]
----
# Kafka Topic: outbox.event.order
# Kafka Message key: "1"<commit_msg>DBZ-4563 Remove redundant list item<commit_after>:page-aliases: configuration/outbox-event-router.adoc
// Category: debezium-using
// Type: assembly
// ModuleID: configuring-debezium-connectors-to-use-the-outbox-pattern
// Title: Configuring {prodname} connectors to use the outbox pattern
[id="outbox-event-router"]
= Outbox Event Router

:toc:
:toc-placement: macro
:linkattrs:
:icons: font
:source-highlighter: highlight.js

toc::[]

The outbox pattern is a way to safely and reliably exchange data between multiple (micro) services. An outbox pattern implementation avoids inconsistencies between a service's internal state (as typically persisted in its database) and state in events consumed by services that need the same data.

To implement the outbox pattern in a {prodname} application, configure a {prodname} connector to:

* Capture changes in an outbox table
* Apply the {prodname} outbox event router single message transformation (SMT)

A {prodname} connector that is configured to apply the outbox SMT should capture changes that occur in an outbox table only.
For more information, see xref:options-for-applying-the-transformation-selectively[Options for applying the transformation selectively].

A connector can capture changes in more than one outbox table only if each outbox table has the same structure.
ifdef::product[]
[IMPORTANT]
====
The outbox event router SMT is a Technology Preview feature only.
Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete.
Red Hat does not recommend using them in production.
These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see link:https://access.redhat.com/support/offerings/techpreview[https://access.redhat.com/support/offerings/techpreview].
====
endif::product[]
See link:https://debezium.io/blog/2019/02/19/reliable-microservices-data-exchange-with-the-outbox-pattern/[Reliable Microservices Data Exchange With the Outbox Pattern] to learn about why the outbox pattern is useful and how it works.

ifdef::community[]
For an example that you can run, see the  link:https://github.com/debezium/debezium-examples/tree/main/outbox[outbox pattern demo], which is in the {prodname} examples repository. It includes an example of how to configure a {prodname} connector to run the outbox event router SMT.
endif::community[]

[NOTE]
====
This SMT does *not* support the MongoDB connector;
please use the xref:transformations/mongodb-outbox-event-router.adoc[MongoDB outbox event router] SMT with that connector.
====

ifdef::product[]
The following topics provide details:

* xref:example-of-a-debezium-outbox-message[]
* xref:outbox-table-structure-expected-by-debezium-outbox-event-router-smt[]
* xref:basic-debezium-outbox-event-router-smt-configuration[]
* xref:options-for-applying-the-outbox-event-router-transformation-selectively[]
* xref:using-avro-as-the-payload-format-in-debezium-outbox-messages[]
* xref:emitting-additional-fields-in-debezium-outbox-messages[]
* xref:expanding-escaped-json-string-as-json[]
* xref:options-for-configuring-outbox-event-router-transformation[]
endif::product[]

// Type: concept
// ModuleID: example-of-a-debezium-outbox-message
// Title: Example of a {prodname} outbox message
[[example-outbox-message]]
== Example outbox message

To learn about how to configure the {prodname} outbox event router SMT, consider the following example of a {prodname} outbox message:

[source,javascript,indent=0]
----
# Kafka Topic: outbox.event.order
# Kafka Message key: "1"
{'fraction_non_alphanumeric': 0.09432210135314407, 'fraction_numerical': 0.003183868400106129, 'mean_word_length': 5.454623287671233, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4906743', 'n_tokens_mistral': 2183, 'n_tokens_neox': 2111, 'n_words': 754}