-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
README.md
39 lines (36 loc) · 1.72 KB
/
README.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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`
- make request so that XA resource is registered (it can be any HTTP request that results in XA transaction):
- `curl -v localhost:8080/transaction-logs/annotation-way`
- wait until application log contains `Recovering transaction`
- now you can see that the `audit_log` database table contains 2 inserts:
- enter `SELECT * FROM audit_log;`
```
id | message | datasource
----+---------+-----------------
1 | crash | <default>
2 | crash | object-store-ds
```