feat(eventbus): add Kafka/Redpanda producer and admin auto-configuration - #200
Merged
Conversation
Introduce libs/fincore-eventbus, a Spring auto-configuration library that any service includes to get a broker producer and admin client. One spring-kafka client serves both Redpanda (default) and Apache Kafka (prod); the difference is connection and security properties only. Durability is fixed (acks=all, enable.idempotence=true) so a ledger event can never be silently dropped or duplicated at the producer; bootstrap-servers is required and the auto-config is inert until a service opts in. Every bean is conditional-on-missing so a consumer can override. spring-kafka is managed by the Spring Boot BOM imported via Gradle platform(). Covered by unit tests plus a Testcontainers-Redpanda integration test. Closes #189
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Second slice of E-03 (Event Bus). Adds
libs/fincore-eventbus, a Spring auto-configuration library that any service includes to get a broker producer and admin client. The outbox dispatcher (#190) will use these beans; this slice stops at "the producer/admin client exists, is correct, and connects".spring-kafkaclient serves both Redpanda (default dev/test) and Apache Kafka (prod). Redpanda speaks the Kafka protocol, so the "profile" difference is purely connection/security properties, not code.EventBusProperties(@ConfigurationProperties("fincore.eventbus")):bootstrapServers(required),clientId, and asecuritygroup (protocol + optional SASL mechanism/JAAS, sourced from env).EventBusAutoConfiguration:ProducerFactory/KafkaTemplate<String,String>/KafkaAdminbeans, each@ConditionalOnMissingBeanso a consumer can override.acks=all+enable.idempotence=trueare hardcoded so a ledger event can never be silently dropped or duplicated at the producer. Connection and security stay configurable.@ConditionalOnProperty(fincore.eventbus.bootstrap-servers)and is on no service classpath yet, so it is inert until a service opts in (the ledger build is untouched).Decisions (see plan.md)
spring-kafkanow; Spring Cloud Stream is its own slice (F-03.7 Spring Cloud Stream integration #194).platform()rather than theio.spring.dependency-managementplugin — the plugin applies the BOM to every configuration including detekt's, downgrading detekt's bundled Kotlin compiler.Gates
Local (
-x integrationTest, Docker is unavailable in WSL)::libs:fincore-eventbus:{test,detekt,detektTest,spotlessCheck,assemble,compileIntegrationTestKotlin}green. The Testcontainers-Redpanda IT (publish round-trip + admin topic) runs on CI. critic GO-WITH-CHANGES (applied), code-reviewer APPROVE (nits applied), security-auditor PASS, evaluator 0.88.Closes #189