Skip to content

Commit

Permalink
revieving the chapter
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Maléř <[email protected]>

Fixes

Signed-off-by: Michal Maléř <[email protected]>

Fixes

Signed-off-by: Michal Maléř <[email protected]>
  • Loading branch information
MichalMaler committed Jul 12, 2023
1 parent cc5514c commit 1f6e82e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
4 changes: 3 additions & 1 deletion docs/src/main/asciidoc/datasource.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,9 @@ You can override this by setting the `transactions` configuration property:
* `quarkus.datasource.jdbc.transactions` for default unnamend datasource
* `quarkus.datasource._<datasource-name>_.jdbc.transactions` for named datasource

See the <<configuration-reference,Configuration Reference>> section below.
For more information, see the <<configuration-reference,Configuration reference>> section below.

To facilitate the storage of transaction logs in a database by using JDBC, see xref:transaction.adoc#jdbcstore[Configuring transaction logs to be stored in a datasource] section of the xref:transaction.adoc[Using transactions in Quarkus] guide.

==== Named datasources

Expand Down
31 changes: 26 additions & 5 deletions docs/src/main/asciidoc/transaction.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -362,15 +362,36 @@ NOTE: The `event` object represents the transaction ID, and defines `toString()`
TIP: In listener methods, you can access more information about the transaction in progress by accessing the `TransactionManager`,
which is a CDI bean and can be ``@Inject``ed.

== Configuring transaction log to be stored in a DataSource
[[jdbcstore]]
== Configure storing of Quarkus transaction logs in a database

The Narayana project has the capability to store the transaction logs into a JDBC Datasource; this should be our recommendation for users needing transaction recovery capabilities, especially when running in volatile containers.
In cloud environments where persistent storage is not available, such as when application containers are unable to use persistent volumes, you can configure the transaction management to store transaction logs in a database by using a JDBC datasource.

To enable this capability, you need to set `quarkus.transaction-manager.object-store.type` to `jdbc` explicitly. Also, you can specify a datasource name to be used for the transaction log storage by setting `quarkus.transaction-manager.object-store.datasource`. It will use the default datasource configuration if not specified.
IMPORTANT: While there are several benefits to using a database to store transaction logs, you might notice a reduction in performance compared with using the file system to store the logs.

If you enable `quarkus.transaction-manager.object-store.create-table`, the transaction log table will be created automatically if it does not exist.
Quarkus allows the following JDBC-specific configuration of the object store included in `quarkus.transacion-manager.object-store.<property>` properties, where <property> can be:

NOTE: When enabling this capability, the transaction node identifier must be set through `quarkus.transaction-manager.node-name`.
* `type` (_string_): Configure this property to `jdbc` to enable usage of a Quarkus JDBC datasource for transaction logging.
The default value is `file-system`.
* `datasource` (_string_): Specify the name of the datasource for the transaction log storage.
If no value is provided for the `datasource` property, Quarkus uses the xref:datasource.adoc#dev-services[default datasource].
* `create-table` (_boolean_): When set to `true`, the transaction log table gets automatically created if it does not already exist.
The default value is `false`.
* `drop-table` (_boolean_): When set to `true`, the table creation is canceled on startup if it exists.
The default value is `false`.
* `table-prefix` (string): Specify the prefix for a related table name.
The default value is `quarkus_`.

[NOTE]
====
To work around the current known issue of link:https://issues.redhat.com/browse/AG-209[Agroal having a different view on running transaction checks], set the datasource transaction type for the datasource responsible for writing the transaction logs to `disabled`:
----
quarkus.datasource.TX_LOG.jdbc.transactions=disabled
----
This example uses TX_LOG as the datasource name.
====


== Why always having a transaction manager?
Expand Down

0 comments on commit 1f6e82e

Please sign in to comment.