refactor: replace custom CQRS/Kafka/Outbox infrastructure with Wolverine - #97
Merged
Conversation
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.
Replaces the hand-rolled messaging and CQRS infrastructure with WolverineFx 6.30. Same team as Marten, so the durable inbox/outbox reuses the Marten event store directly, without Debezium and Kafka Connect or a polling worker. The move also turns OrderSaga into a real Wolverine saga and lets tracing lean on Wolverine's native handler spans instead of manual plumbing.
ICommandBus/IQueryBus+ reflection dispatchConfluent.Kafkaconsumer/producer +KafkaBackgroundWorkermt_doc_outboxmessagesOrderSaga : Wolverine.SagaITraceable+TraceTaggingMiddleware+TelemetryTags[Audit]on the messageOrderIdReason
The previous custom stack duplicated what Wolverine does natively and carried real operational weight: a Debezium connector, a Kafka Connect container, a polling background worker, and bespoke tracing middleware. Wolverine gives the same guarantees (durable, exactly-once-ish delivery, retries, dead letter, etc) with less code and a supported upgrade path.
Key changes
CQRS/,EventBus/,Outbox/,Kafka/abstractions.ICommand/IQuerysurvive as slim markers forCustomControllerBaseoverload resolution only.IntegrationEventis now a pure marker.AddCoreInfrastructure; the three broker participants (Order/Payment/Shipment) configureUseKafkawith durable inbox/outbox in theirProgram.cs.[MessageIdentity(nameof(X))]so each bounded context's copy shares one wire name (and the name survives namespace moves).AddHttpClient<T>, which Wolverine 6's codegen can't inline.UseServiceClientServiceLocation()(new, inEcommerceDDD.ServiceClients) whitelists exactly those client types.StronglyTypedId.ToString()added so[Audit]writes the bare id, so the SPA's Aspire deep-link (order.id) keeps working as before.