diff --git a/README.md b/README.md index c7261135d5..1037c13204 100644 --- a/README.md +++ b/README.md @@ -131,6 +131,7 @@ See [CONTRIBUTING](CONTRIBUTING.md) for how to build these examples. * [Google Cloud Functions](./google-cloud-functions-quickstart): How to create Google Cloud Functions * [Google Cloud Functions HTTP](./google-cloud-functions-http-quickstart): How to bind our HTTP layer (JAX-RS, Servlet or Reactive Route) to Google Cloud Functions * [JTA](./jta-quickstart): How use JTA transactions with HTTP/REST +* [Quarkus transaction logs in a database](https://quarkus.io/guides/transaction#jdbcstore) How to configure app for automatic transaction recovery * [Reactive Messaging with HTTP](./reactive-messaging-http-quickstart): How to consume and produce HTTP messages with Reactive Messaging * [Reactive Messaging with Web Sockets](./reactive-messaging-websockets-quickstart): How to consume and produce messages via Web Sockets with Reactive Messaging * [Elasticsearch](./elasticsearch-quickstart): How to use the Elasticsearch REST client and the Java API client diff --git a/narayana-transaction-logs-quickstart/.dockerignore b/narayana-transaction-logs-quickstart/.dockerignore new file mode 100644 index 0000000000..b86c7ac340 --- /dev/null +++ b/narayana-transaction-logs-quickstart/.dockerignore @@ -0,0 +1,4 @@ +* +!target/*-runner +!target/*-runner.jar +!target/lib/* \ No newline at end of file diff --git a/narayana-transaction-logs-quickstart/.gitignore b/narayana-transaction-logs-quickstart/.gitignore new file mode 100644 index 0000000000..087a18358f --- /dev/null +++ b/narayana-transaction-logs-quickstart/.gitignore @@ -0,0 +1,35 @@ +# Eclipse +.project +.classpath +.settings/ +bin/ + +# IntelliJ +.idea +*.ipr +*.iml +*.iws + +# NetBeans +nb-configuration.xml + +# Visual Studio Code +.vscode + +# OSX +.DS_Store + +# Vim +*.swp +*.swo + +# patch +*.orig +*.rej + +# Maven +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +release.properties \ No newline at end of file diff --git a/narayana-transaction-logs-quickstart/.mvn/wrapper/maven-wrapper.jar b/narayana-transaction-logs-quickstart/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000..bf82ff01c6 Binary files /dev/null and b/narayana-transaction-logs-quickstart/.mvn/wrapper/maven-wrapper.jar differ diff --git a/narayana-transaction-logs-quickstart/.mvn/wrapper/maven-wrapper.properties b/narayana-transaction-logs-quickstart/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000..dc3affce3d --- /dev/null +++ b/narayana-transaction-logs-quickstart/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar diff --git a/narayana-transaction-logs-quickstart/README.md b/narayana-transaction-logs-quickstart/README.md new file mode 100644 index 0000000000..c437e5bc78 --- /dev/null +++ b/narayana-transaction-logs-quickstart/README.md @@ -0,0 +1,36 @@ +Quarkus - Narayana - Transaction logs +======================== + +This QuickStart demonstrates how your Quarkus application can be configured for automatic transaction recovery. + +## Test crash recovery + +- build application: + - `./mvnw clean package -DskipTests -DskipITs` +- remove previous database volumes, so that we start with a clean sheet: + - `docker-compose down --volumes` +- start database: + - `docker compose up` +- wait until container has started and is ready to accept connections +- start application: + - `java -jar ./target/quarkus-app/quarkus-run.jar` +- send a message to make transaction and crash application: + - `curl -v localhost:8080/transaction-logs/transaction-recovery` +- inspect JDBC Object Store: + - connect to Postgres container: + - execute `docker exec -it $(docker ps | grep 'postgres' | awk '{print $1}') psql -U quarkus_test -W narayana_transaction_logs_db` + - enter password `quarkus_test` + - now you can see that JDBC object store contains transaction waiting for recovery: + - enter `SELECT * FROM quarkus_jbosststxtable;` + - table we were trying to insert when application crashed is empty: + - enter `SELECT * FROM audit_log;` +- start application again: + - `java -jar ./target/quarkus-app/quarkus-run.jar` +- in a moment, you will see that the `audit_log` database table contains 2 inserts: + - enter `SELECT * FROM audit_log;` + ``` + id | message | datasource + ----+---------+----------------- + 1 | crash | + 2 | crash | object-store-ds + ``` \ No newline at end of file diff --git a/narayana-transaction-logs-quickstart/docker-compose.yml b/narayana-transaction-logs-quickstart/docker-compose.yml new file mode 100644 index 0000000000..67cab64606 --- /dev/null +++ b/narayana-transaction-logs-quickstart/docker-compose.yml @@ -0,0 +1,16 @@ +version: '2.4' + +services: + postgres: + container_name: narayana-transaction-logs-database + image: "postgres:latest" + restart: always + volumes: + - ./init-script.sql:/docker-entrypoint-initdb.d/init-script.sql + command: "--max_prepared_transactions=100" + environment: + POSTGRES_USER: "quarkus_test" + POSTGRES_PASSWORD: "quarkus_test" + POSTGRES_DB: "narayana_transaction_logs_db" + ports: + - "5432:5432" diff --git a/narayana-transaction-logs-quickstart/init-script.sql b/narayana-transaction-logs-quickstart/init-script.sql new file mode 100644 index 0000000000..fa45e3ba15 --- /dev/null +++ b/narayana-transaction-logs-quickstart/init-script.sql @@ -0,0 +1,14 @@ +CREATE TABLE quarkus_jbosststxtable (statetype integer not null, hidden integer not null, typename character varying(255) not null, uidstring character varying(255) not null, objectstate bytea); +CREATE TABLE quarkus_jbosststxtable_historical_data AS SELECT * FROM quarkus_jbosststxtable; +CREATE OR REPLACE FUNCTION object_store_historical_data() RETURNS TRIGGER AS ' + BEGIN + INSERT INTO quarkus_jbosststxtable_historical_data(statetype, hidden, typename, uidstring, objectstate) VALUES (NEW.statetype, NEW.hidden, NEW.typename, NEW.uidstring, NEW.objectstate); + RETURN NULL; + END; +' LANGUAGE plpgsql; +CREATE TRIGGER object_store_historical_data_trigger AFTER INSERT ON quarkus_jbosststxtable FOR EACH ROW EXECUTE FUNCTION object_store_historical_data(); +CREATE TABLE audit_log (id BIGSERIAL PRIMARY KEY, message VARCHAR(10), datasource VARCHAR(40)); +CREATE TABLE example (data VARCHAR(6) NOT NULL); +INSERT INTO example VALUES ('first'); +INSERT INTO example VALUES ('second'); +INSERT INTO example VALUES ('third'); \ No newline at end of file diff --git a/narayana-transaction-logs-quickstart/mvnw b/narayana-transaction-logs-quickstart/mvnw new file mode 100755 index 0000000000..5643201c7d --- /dev/null +++ b/narayana-transaction-logs-quickstart/mvnw @@ -0,0 +1,316 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /usr/local/etc/mavenrc ] ; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`\\unset -f command; \\command -v java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/narayana-transaction-logs-quickstart/mvnw.cmd b/narayana-transaction-logs-quickstart/mvnw.cmd new file mode 100644 index 0000000000..8a15b7f311 --- /dev/null +++ b/narayana-transaction-logs-quickstart/mvnw.cmd @@ -0,0 +1,188 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* +if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% ^ + %JVM_CONFIG_MAVEN_PROPS% ^ + %MAVEN_OPTS% ^ + %MAVEN_DEBUG_OPTS% ^ + -classpath %WRAPPER_JAR% ^ + "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ + %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" +if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%"=="on" pause + +if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% + +cmd /C exit /B %ERROR_CODE% diff --git a/narayana-transaction-logs-quickstart/pom.xml b/narayana-transaction-logs-quickstart/pom.xml new file mode 100644 index 0000000000..070d1fc5b5 --- /dev/null +++ b/narayana-transaction-logs-quickstart/pom.xml @@ -0,0 +1,161 @@ + + + 4.0.0 + org.acme + narayana-transaction-logs-quickstart + 1.0.0-SNAPSHOT + + quarkus-bom + io.quarkus + 999-SNAPSHOT + 3.8.1 + 3.0.0-M7 + 11 + 11 + true + UTF-8 + 0.43.2 + + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + + + + io.quarkus + quarkus-resteasy-reactive + + + io.quarkus + quarkus-narayana-jta + + + io.quarkus + quarkus-jdbc-postgresql + + + io.quarkus + quarkus-agroal + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + org.awaitility + awaitility + test + + + + + + ${quarkus.platform.group-id} + quarkus-maven-plugin + ${quarkus.platform.version} + + + + build + + + + + + maven-surefire-plugin + ${surefire-plugin.version} + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + io.fabric8 + docker-maven-plugin + ${docker-plugin.version} + + ${skipTests} + + + + compose + . + docker-compose.yml + + + + + + + docker-start + test-compile + + stop + start + + + + docker-stop + post-integration-test + + stop + + + + + + + + + native + + + native + + + + + + maven-failsafe-plugin + ${surefire-plugin.version} + + + + integration-test + verify + + + + ${project.build.directory}/${project.build.finalName}-runner + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + + native + + + + diff --git a/narayana-transaction-logs-quickstart/src/main/java/org/acme/quickstart/TransactionLogsResource.java b/narayana-transaction-logs-quickstart/src/main/java/org/acme/quickstart/TransactionLogsResource.java new file mode 100644 index 0000000000..ac11cb0d29 --- /dev/null +++ b/narayana-transaction-logs-quickstart/src/main/java/org/acme/quickstart/TransactionLogsResource.java @@ -0,0 +1,191 @@ +package org.acme.quickstart; + +import jakarta.inject.Inject; +import jakarta.inject.Named; + +import jakarta.transaction.HeuristicMixedException; +import jakarta.transaction.HeuristicRollbackException; +import jakarta.transaction.NotSupportedException; +import jakarta.transaction.RollbackException; +import jakarta.transaction.SystemException; +import jakarta.transaction.TransactionManager; +import jakarta.transaction.Transactional; +import jakarta.transaction.UserTransaction; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; + +import jakarta.ws.rs.core.MediaType; +import org.jboss.resteasy.reactive.RestQuery; + +import javax.sql.DataSource; +import java.sql.SQLException; + +import static io.quarkus.datasource.common.runtime.DataSourceUtil.DEFAULT_DATASOURCE_NAME; + +@Path("/transaction-logs") +public class TransactionLogsResource { + + @Inject + DataSource dataSource; + + @Named("other-ds") + @Inject + DataSource otherDataSource; + + @Named("object-store-ds") + @Inject + DataSource objectStoreDataSource; + + @Inject + TransactionManager transactionManager; + + @Inject + UserTransaction userTransaction; + + @GET + @Produces(MediaType.TEXT_PLAIN) + @Transactional + @Path("/annotation-way") + public boolean annotationWay(@RestQuery boolean rollback) throws SystemException { + var result = makeTransaction(); + if (rollback) { + transactionManager.getTransaction().setRollbackOnly(); + } + return result; + } + + @GET + @Produces(MediaType.TEXT_PLAIN) + @Path("/static-transaction-manager-way") + public boolean staticTransactionManagerWay(@RestQuery boolean rollback) throws SystemException, NotSupportedException, + HeuristicRollbackException, HeuristicMixedException, RollbackException { + com.arjuna.ats.jta.TransactionManager.transactionManager().begin(); + var result = makeTransaction(); + if (rollback) { + com.arjuna.ats.jta.TransactionManager.transactionManager().rollback(); + } else { + com.arjuna.ats.jta.TransactionManager.transactionManager().commit(); + } + return result; + } + + @GET + @Produces(MediaType.TEXT_PLAIN) + @Path("/injected-transaction-manager-way") + public boolean injectedTransactionManagerWay(@RestQuery boolean rollback) throws SystemException, NotSupportedException, + HeuristicRollbackException, HeuristicMixedException, RollbackException { + transactionManager.begin(); + var result = makeTransaction(); + if (rollback) { + transactionManager.rollback(); + } else { + transactionManager.commit(); + } + return result; + } + + @GET + @Produces(MediaType.TEXT_PLAIN) + @Path("/injected-user-transaction-way") + public boolean injectedUserTransactionWay(@RestQuery boolean rollback) throws SystemException, NotSupportedException, + HeuristicRollbackException, HeuristicMixedException, RollbackException { + userTransaction.begin(); + var result = makeTransaction(); + if (rollback) { + userTransaction.rollback(); + } else { + userTransaction.commit(); + } + return result; + } + + @GET + @Produces(MediaType.TEXT_PLAIN) + @Path("/static-user-transaction-way") + public boolean staticUserTransactionWay(@RestQuery boolean rollback) throws SystemException, NotSupportedException, + HeuristicRollbackException, HeuristicMixedException, RollbackException { + com.arjuna.ats.jta.UserTransaction.userTransaction().begin(); + var result = makeTransaction(); + if (rollback) { + com.arjuna.ats.jta.UserTransaction.userTransaction().rollback(); + } else { + com.arjuna.ats.jta.UserTransaction.userTransaction().commit(); + } + return result; + } + + @GET + @Produces(MediaType.TEXT_PLAIN) + @Path("/historical-data") + public String inspectTransactionsLogHistoricalData() { + // see all data that was written into JDBC object store + // we back up all JDBC object store inserts so that we can inspect them after we execute transaction + // such a table with historical data only makes sense for our tests and must not be used in production + return makeQuery(objectStoreDataSource, "SELECT uidstring FROM quarkus_jbosststxtable_historical_data"); + } + + @Transactional + @DELETE + public void deleteObjectStoreHistoricalData() { + // delete content of database table where we back up each insert into JDBC object store + // it is only necessary for our tests so that we can run every test against clean table + try (var connection = dataSource.getConnection()) { + try (var statement = connection.createStatement()) { + statement.executeUpdate("DELETE FROM quarkus_jbosststxtable_historical_data"); + } + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + @Path("/transaction-recovery") + @Transactional + @GET + public void recovery() { + insertCrashIntoAuditLog(DEFAULT_DATASOURCE_NAME, dataSource); + insertCrashIntoAuditLog("object-store-ds", otherDataSource); + } + + private boolean makeTransaction() { + // involve two XA resources in a transaction so that JDBC object store is written into + return getFirstExample(dataSource).equals(getFirstExample(otherDataSource)); + } + + private static String getFirstExample(DataSource dataSource) { + return makeQuery(dataSource, "SELECT * FROM example WHERE data='first'"); + } + + private static String makeQuery(DataSource dataSource, String query) { + try (var connection = dataSource.getConnection()) { + try (var statement = connection.createStatement()) { + var result = statement.executeQuery(query); + if (result.next()) { + return result.getString(1); + } else { + return null; + } + } + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + private static void insertCrashIntoAuditLog(String dataSourceName, DataSource dataSource) { + makeUpdateQuery( + dataSource, + "INSERT INTO audit_log (message, datasource) VALUES ('crash', '" + dataSourceName + "')" + ); + } + + private static int makeUpdateQuery(DataSource dataSource, String query) { + try (var connection = dataSource.getConnection()) { + try (var statement = connection.createStatement()) { + return statement.executeUpdate(query); + } + } catch (SQLException e) { + throw new RuntimeException(e); + } + } +} diff --git a/narayana-transaction-logs-quickstart/src/main/java/org/acme/quickstart/recovery/CrashingPGXADataSource.java b/narayana-transaction-logs-quickstart/src/main/java/org/acme/quickstart/recovery/CrashingPGXADataSource.java new file mode 100644 index 0000000000..a8dc1a86c8 --- /dev/null +++ b/narayana-transaction-logs-quickstart/src/main/java/org/acme/quickstart/recovery/CrashingPGXADataSource.java @@ -0,0 +1,30 @@ +package org.acme.quickstart.recovery; + +import org.postgresql.core.BaseConnection; +import org.postgresql.xa.PGXAConnection; +import org.postgresql.xa.PGXADataSource; +import org.postgresql.xa.PGXADataSourceFactory; + +import javax.naming.Reference; +import javax.sql.XAConnection; +import java.sql.Connection; +import java.sql.SQLException; + +public class CrashingPGXADataSource extends PGXADataSource { + + @Override + public XAConnection getXAConnection() throws SQLException { + return this.getXAConnection(this.getUser(), this.getPassword()); + } + + @Override + public XAConnection getXAConnection(String user, String password) throws SQLException { + Connection con = super.getConnection(user, password); + return new CrashingXAConnection((PGXAConnection) super.getXAConnection(user, password), (BaseConnection) con); + } + + @Override + protected Reference createReference() { + return new Reference(CrashingPGXADataSource.class.getName(), PGXADataSourceFactory.class.getName(), (String)null); + } +} diff --git a/narayana-transaction-logs-quickstart/src/main/java/org/acme/quickstart/recovery/CrashingXAConnection.java b/narayana-transaction-logs-quickstart/src/main/java/org/acme/quickstart/recovery/CrashingXAConnection.java new file mode 100644 index 0000000000..2938443d9c --- /dev/null +++ b/narayana-transaction-logs-quickstart/src/main/java/org/acme/quickstart/recovery/CrashingXAConnection.java @@ -0,0 +1,141 @@ +package org.acme.quickstart.recovery; + +import io.quarkus.arc.Arc; +import io.quarkus.arc.InstanceHandle; +import io.vertx.ext.web.RoutingContext; +import org.jboss.logging.Logger; +import org.postgresql.core.BaseConnection; +import org.postgresql.xa.PGXAConnection; + +import javax.sql.ConnectionEventListener; +import javax.sql.StatementEventListener; +import javax.transaction.xa.XAException; +import javax.transaction.xa.XAResource; +import javax.transaction.xa.Xid; +import java.sql.Connection; +import java.sql.SQLException; + +public class CrashingXAConnection extends PGXAConnection { + + private static final Logger LOG = Logger.getLogger(CrashingXAConnection.class); + private final PGXAConnection delegate; + private volatile InstanceHandle routingContextInstanceHandle; + + CrashingXAConnection(PGXAConnection delegate, BaseConnection connection) throws SQLException { + super(connection); + this.delegate = delegate; + } + + @Override + public XAResource getXAResource() { + return this; + } + + @Override + public Connection getConnection() throws SQLException { + return delegate.getConnection(); + } + + @Override + public void close() throws SQLException { + delegate.close(); + } + + @Override + public void addConnectionEventListener(ConnectionEventListener listener) { + delegate.addConnectionEventListener(listener); + } + + @Override + public void removeConnectionEventListener(ConnectionEventListener listener) { + delegate.removeConnectionEventListener(listener); + } + + @Override + public void addStatementEventListener(StatementEventListener listener) { + delegate.addStatementEventListener(listener); + } + + @Override + public void removeStatementEventListener(StatementEventListener listener) { + delegate.removeStatementEventListener(listener); + } + + private RoutingContext getRoutingContext() { + if (Arc.container() == null || !Arc.container().requestContext().isActive()) { + // during transaction recovery, request context is not active + return null; + } + + if (routingContextInstanceHandle == null) { + routingContextInstanceHandle = Arc.container().instance(RoutingContext.class); + } + + return routingContextInstanceHandle.get(); + } + + private boolean shouldCrash() { + var ctx = getRoutingContext(); + if (ctx == null) { + return false; + } + return ctx.request().path().endsWith("/transaction-recovery"); + } + + @Override + public void commit(Xid xid, boolean onePhase) throws XAException { + if (shouldCrash()) { + LOG.info("Crashing the system"); + Runtime.getRuntime().halt(1); + } + delegate.commit(xid, onePhase); + } + + @Override + public void end(Xid xid, int flags) throws XAException { + delegate.end(xid, flags); + } + + @Override + public void forget(Xid xid) throws XAException { + delegate.forget(xid); + } + + @Override + public int getTransactionTimeout() { + return delegate.getTransactionTimeout(); + } + + @Override + public boolean isSameRM(XAResource xares) throws XAException { + if (xares instanceof CrashingXAConnection) { + return delegate.isSameRM(((CrashingXAConnection) xares).delegate); + } + return delegate.isSameRM(xares); + } + + @Override + public int prepare(Xid xid) throws XAException { + return delegate.prepare(xid); + } + + @Override + public Xid[] recover(int flag) throws XAException { + return delegate.recover(flag); + } + + @Override + public void rollback(Xid xid) throws XAException { + delegate.rollback(xid); + } + + @Override + public boolean setTransactionTimeout(int seconds) { + return delegate.setTransactionTimeout(seconds); + } + + @Override + public void start(Xid xid, int flags) throws XAException { + delegate.start(xid, flags); + } +} diff --git a/narayana-transaction-logs-quickstart/src/main/resources/META-INF/resources/index.html b/narayana-transaction-logs-quickstart/src/main/resources/META-INF/resources/index.html new file mode 100644 index 0000000000..0186c59b93 --- /dev/null +++ b/narayana-transaction-logs-quickstart/src/main/resources/META-INF/resources/index.html @@ -0,0 +1,152 @@ + + + + + getting-started - 1.0-SNAPSHOT + + + + + + +
+
+

Congratulations, you have created a new Quarkus application.

+ +

Why do you see this?

+ +

This page is served by Quarkus. The source is in + src/main/resources/META-INF/resources/index.html.

+ +

What can I do from here?

+ +

If not already done, run the application in dev mode using: mvn compile quarkus:dev. +

+
    +
  • Add REST resources, Servlets, functions and other services in src/main/java.
  • +
  • Your static assets are located in src/main/resources/META-INF/resources.
  • +
  • Configure your application in src/main/resources/META-INF/microprofile-config.properties. +
  • +
+ +

How do I get rid of this page?

+

Just delete the src/main/resources/META-INF/resources/index.html file.

+
+
+
+

Application

+
    +
  • GroupId: org.acme
  • +
  • ArtifactId: jta
  • +
  • Version: 1.0-SNAPSHOT
  • +
  • Quarkus Version: 999-SNAPSHOT
  • +
+
+ +
+
+ + + + diff --git a/narayana-transaction-logs-quickstart/src/main/resources/application.properties b/narayana-transaction-logs-quickstart/src/main/resources/application.properties new file mode 100644 index 0000000000..ead6a9ebf6 --- /dev/null +++ b/narayana-transaction-logs-quickstart/src/main/resources/application.properties @@ -0,0 +1,26 @@ +# configure 2 datasources with enabled XA transactions +quarkus.datasource.db-kind=postgresql +quarkus.datasource.username=quarkus_test +quarkus.datasource.password=quarkus_test +quarkus.datasource.jdbc.url=jdbc:postgresql://localhost/narayana_transaction_logs_db +quarkus.datasource.jdbc.transactions=xa +quarkus.datasource.jdbc.driver=org.acme.quickstart.recovery.CrashingPGXADataSource +quarkus.datasource.other-ds.jdbc.transactions=${quarkus.datasource.jdbc.transactions} +quarkus.datasource.other-ds.db-kind=${quarkus.datasource.db-kind} +quarkus.datasource.other-ds.username=${quarkus.datasource.username} +quarkus.datasource.other-ds.password=${quarkus.datasource.password} +quarkus.datasource.other-ds.jdbc.url=${quarkus.datasource.jdbc.url} +quarkus.datasource.other-ds.jdbc.driver=${quarkus.datasource.jdbc.driver} + +# configure transaction manager to use JDBC object store and enable automatic recovery +quarkus.transaction-manager.node-name=quarkus-quickstart +quarkus.transaction-manager.object-store.type=jdbc +quarkus.transaction-manager.object-store.datasource=object-store-ds +quarkus.transaction-manager.enable-recovery=true + +# datasource used for the JDBC object store must have disabled transactions +quarkus.datasource.object-store-ds.jdbc.transactions=disabled +quarkus.datasource.object-store-ds.db-kind=${quarkus.datasource.db-kind} +quarkus.datasource.object-store-ds.username=${quarkus.datasource.username} +quarkus.datasource.object-store-ds.password=${quarkus.datasource.password} +quarkus.datasource.object-store-ds.jdbc.url=${quarkus.datasource.jdbc.url} diff --git a/narayana-transaction-logs-quickstart/src/test/java/org/acme/quickstart/JdbcObjectStoreIT.java b/narayana-transaction-logs-quickstart/src/test/java/org/acme/quickstart/JdbcObjectStoreIT.java new file mode 100644 index 0000000000..96214764d6 --- /dev/null +++ b/narayana-transaction-logs-quickstart/src/test/java/org/acme/quickstart/JdbcObjectStoreIT.java @@ -0,0 +1,9 @@ +package org.acme.quickstart; + +import io.quarkus.test.junit.QuarkusIntegrationTest; + +@QuarkusIntegrationTest +public class JdbcObjectStoreIT extends JdbcObjectStoreTest { + + // Execute the same tests but in native mode. +} diff --git a/narayana-transaction-logs-quickstart/src/test/java/org/acme/quickstart/JdbcObjectStoreTest.java b/narayana-transaction-logs-quickstart/src/test/java/org/acme/quickstart/JdbcObjectStoreTest.java new file mode 100644 index 0000000000..0785f412cf --- /dev/null +++ b/narayana-transaction-logs-quickstart/src/test/java/org/acme/quickstart/JdbcObjectStoreTest.java @@ -0,0 +1,92 @@ +package org.acme.quickstart; + +import static io.restassured.RestAssured.given; + +import io.restassured.RestAssured; +import org.hamcrest.Matchers; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import io.quarkus.test.junit.QuarkusTest; + +@QuarkusTest +public class JdbcObjectStoreTest { + + @BeforeEach + public void prepareTest() { + cleanObjectStoreHistoricalData(); + } + + @Test + public void testTransactionLogsWithTransactionalAnnotation() { + testTransactionLogs("annotation"); + } + + @Test + public void testTransactionLogsWithStaticTransactionManager() { + testTransactionLogs("static-transaction-manager"); + } + + @Test + public void testTransactionsLogWithInjectedTransactionManager() { + testTransactionLogs("injected-transaction-manager"); + } + + @Test + public void testTransactionsLogWithInjectedUserTransaction() { + testTransactionLogs("injected-user-transaction"); + } + + @Test + public void testTransactionsLogWithStaticUserTransaction() { + testTransactionLogs("static-user-transaction"); + } + + private static void makeTransactionAndRollback(String beginTransactionWith) { + makeTransaction(beginTransactionWith, true); + } + + private static void makeTransaction(String beginTransactionWith) { + makeTransaction(beginTransactionWith, false); + } + + private static void makeTransaction(String beginTransactionWith, boolean rollback) { + given() + .when() + .queryParam("rollback", rollback) + .get("/transaction-logs/" + beginTransactionWith + "-way") + .then() + .statusCode(200) + .body(Matchers.is("true")); + } + + private static void assureTransactionLogWasUsed() { + given() + .when().get("/transaction-logs/historical-data") + .then() + .statusCode(200) + .body(Matchers.notNullValue()); + } + + private static void assureTransactionLogWasNotUsed() { + given() + .when().get("/transaction-logs/historical-data") + .then() + .statusCode(204); + } + + private static void cleanObjectStoreHistoricalData() { + RestAssured + .delete("/transaction-logs") + .then() + .statusCode(204); + } + + private static void testTransactionLogs(String beginTransactionWith) { + makeTransaction(beginTransactionWith); + assureTransactionLogWasUsed(); + cleanObjectStoreHistoricalData(); + makeTransactionAndRollback(beginTransactionWith); + assureTransactionLogWasNotUsed(); + } +} diff --git a/pom.xml b/pom.xml index 402f5fcc0b..3d50af7df1 100644 --- a/pom.xml +++ b/pom.xml @@ -114,6 +114,7 @@ kafka-panache-quickstart kafka-panache-reactive-quickstart jta-quickstart + narayana-transaction-logs-quickstart