Skip to content

feat(eventbus): add declarative idempotent topic provisioning - #202

Merged
tiana-code merged 1 commit into
mainfrom
feat/E-03-eventbus-topics
Jun 18, 2026
Merged

feat(eventbus): add declarative idempotent topic provisioning#202
tiana-code merged 1 commit into
mainfrom
feat/E-03-eventbus-topics

Conversation

@tiana-code

Copy link
Copy Markdown
Owner

What

Declarative, idempotent topic provisioning for E-03. Operators declare topics under fincore.eventbus.topics[] (name, partitions, replicas, and a generic configs map for retention etc.); they are mapped to a KafkaAdmin.NewTopics bean so the existing KafkaAdmin (from #189) creates any missing topic at startup.

  • Create-only / non-destructive (INV-1): an existing topic is a no-op, never a failure or a data-losing modify/shrink. Re-running is always safe.
  • TopicSpec validates non-blank name and positive partitions/replicas; numeric defaults live in a private companion.
  • The bean is @ConditionalOnMissingBean (overridable) and sits inside the @ConditionalOnProperty(bootstrap-servers) auto-config, so it never activates unless the bus is configured.

Decisions (see plan.md)

  • A single KafkaAdmin.NewTopics holder bean built from a pure newTopics(props) mapping via TopicBuilder (Spring Kafka collects the holder at init), rather than N individual NewTopic beans.
  • Retention is a generic 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

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
@tiana-code tiana-code added this to the v0.2.0 milestone Jun 18, 2026
@tiana-code
tiana-code merged commit ff2c55c into main Jun 18, 2026
8 checks passed
@tiana-code
tiana-code deleted the feat/E-03-eventbus-topics branch June 18, 2026 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

F-03.4 Topic creation / management

1 participant