-
Notifications
You must be signed in to change notification settings - Fork 8
Add quarkus extension #587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦙 MegaLinter status: ✅ SUCCESS
See detailed report in MegaLinter reports |
c19aad4 to
21cd20a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
The purpose of this PR is to add a Quarkus extension for the transactional-outbox library, enabling its use within Quarkus applications. This extends the library's reach beyond Spring applications to include the Quarkus ecosystem.
Key changes:
- Added
outbox-kafka-quarkusandoutbox-kafka-quarkus-deploymentmodules to the project - Implemented complete outbox pattern with Kafka publishing functionality using Quarkus-specific infrastructure
- Included comprehensive test coverage for all core features including tracing, locking, and message publishing
Reviewed Changes
Copilot reviewed 65 out of 66 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| settings.gradle.kts | Added new Quarkus extension modules to the build |
| outbox-kafka-quarkus/src/test/resources/* | Database migration scripts and test configuration |
| outbox-kafka-quarkus/src/test/java/* | Comprehensive test suite covering all functionality |
| outbox-kafka-quarkus/src/main/java/* | Core implementation including services, repositories, publishers, and tracing |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
...fka-quarkus/src/test/java/one/tomorrow/transactionaloutbox/service/TestOutboxRepository.java
Outdated
Show resolved
Hide resolved
...us/src/main/java/one/tomorrow/transactionaloutbox/publisher/DefaultKafkaProducerFactory.java
Show resolved
Hide resolved
...-quarkus/src/main/java/one/tomorrow/transactionaloutbox/repository/OutboxLockRepository.java
Outdated
Show resolved
Hide resolved
...-quarkus/src/main/java/one/tomorrow/transactionaloutbox/repository/OutboxLockRepository.java
Outdated
Show resolved
Hide resolved
...-kafka-quarkus/src/main/java/one/tomorrow/transactionaloutbox/publisher/PublisherConfig.java
Show resolved
Hide resolved
The outbox-kafka-quarkus module contains runtime functionality, the deployment module the required build steps for quarkus. The deployment module duplicates a few test related things from the runtime module to keep the build simple - in general we rather copy things than making the build more complicated. The runtime module uses the quarkus plugin for tests so that we get quarkus test support and are able to run integration tests. Apart from that the runtime module shall just be built via the quarkus extension plugin together with the deployment module. The root gradle build file contains some exceptions for plugins that are needed to make it work, e.g. because the protobuf plugin does not work with quarkus (and we're not using protobuf in the quarkus module - for now we assume it's not needed, can be added on request). Some functionality like trace propagation still needs to be added, also documentation is not yet there.
Similarly as it was added with PR #334 to the spring module
This is very similar to the solution implemented with PR #494 (in commit d1d3834) for spring classic, only that it's using opentelemetry, which is the default tracing solution for quarkus. What does the solution provide: * Adds a span for the message in the transactional-outbox (with start timestamp set to the time when the outbox record was created, and end timestamp set to the time when it's processed and sent to Kafka) * Adds another span for the sending the message to Kafka (start timestamp is the time when the `ProducerRecord` is created, end timestamp is set when message sending got confirmed) * Add tracing headers to the Kafka message, which can be extracted via `Propagator.extract` on consumer side. When opentelemetry is on the classpath, context propagation should be active, otherwise there's no tracing context propagation.
The main readme is only slightly adjusted, so that it does not get too long. Quarkus specific docs are added to the quarkus runtime module.
Applications might use InMemory Channels in tests, which then requires support by transactional-outbox to test event driven processes. For this the abstraction of `MessagePublisher` is introduced, to allow a `KafkaProducer` backed implementation and an `Emitter` based implementation (which can then be configured to be an in-memory connector based emitter).
21cd20a to
e149db3
Compare
e2a5a99 to
950fd50
Compare
thoreottenheym
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice addition of an extension which now supports quarkus! I like the addition of the health check as well as the ability to choose between smallRye emitters and kafka producers. I have no change request since most of the classes are very similar to the already existing implementations. I have to say though, that due to tight capacities on our end i was also not able to invest a lot of time and my knowledge of this project is not yet great, so take this review with a grain of salt :D
...uarkus/src/main/java/one/tomorrow/transactionaloutbox/health/OutboxProcessorHealthCheck.java
Show resolved
Hide resolved
...quarkus/src/main/java/one/tomorrow/transactionaloutbox/config/TransactionalOutboxConfig.java
Show resolved
Hide resolved
|
@thoreottenheym thanks for your review btw, I somehow completely missed that 🙈 |
|
@magro please be aware that we recently upgraded to Spring 7 / Spring Boot 4 and will no longer maintain Spring 6 / Spring Boot 3, i.e. your changes with the next release will only be Spring Boot 4 compatible 🙂 |
In one project we're using Quarkus, where the transactional-outbox would be useful as well. For this I added a Quarkus extension (see e.g. this guide) that makes the transactional-outbox available for Quarkus applications. The main README is only slightly extended, full documentation for the Quarkus extension is in the runtime module of the extension.