feat(eventbus): add declarative idempotent topic provisioning - #202
Merged
Conversation
Declare topics (name, partitions, replicas, configs such as retention.ms) under fincore.eventbus.topics. They are mapped to a KafkaAdmin.NewTopics bean so the existing KafkaAdmin creates any missing topic at startup and leaves existing ones untouched, so provisioning is idempotent and never deletes or shrinks a topic. The bean is conditional-on-missing and inert until the bus is configured. Covered by unit tests plus a Testcontainers-Redpanda integration test. Closes #191
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
Declarative, idempotent topic provisioning for E-03. Operators declare topics under
fincore.eventbus.topics[](name, partitions, replicas, and a genericconfigsmap for retention etc.); they are mapped to aKafkaAdmin.NewTopicsbean so the existingKafkaAdmin(from #189) creates any missing topic at startup.TopicSpecvalidates non-blank name and positive partitions/replicas; numeric defaults live in a private companion.@ConditionalOnMissingBean(overridable) and sits inside the@ConditionalOnProperty(bootstrap-servers)auto-config, so it never activates unless the bus is configured.Decisions (see plan.md)
KafkaAdmin.NewTopicsholder bean built from a purenewTopics(props)mapping viaTopicBuilder(Spring Kafka collects the holder at init), rather than N individualNewTopicbeans.configs["retention.ms"]entry, not a special field.Gates
Local (
-x integrationTest, Docker down in WSL)::libs:fincore-eventbus:{test,detekt,detektTest,spotlessCheck,assemble,compileIntegrationTestKotlin}green. The Testcontainers-Redpanda IT (EventBusTopicProvisioningIT) runs on CI: topic created with the declared partition count, and re-provisioning an existing topic at the same partition count does not fail. critic GO, code-reviewer APPROVE (nits applied), security-auditor PASS, evaluator 0.93.Closes #191