Skip to content

Add MassTransit and NServiceBus shim interfaces for migration#2252

Merged
jeremydmiller merged 1 commit intomainfrom
shims
Mar 2, 2026
Merged

Add MassTransit and NServiceBus shim interfaces for migration#2252
jeremydmiller merged 1 commit intomainfrom
shims

Conversation

@jeremydmiller
Copy link
Member

Summary

  • Add shim interfaces in Wolverine.Shims.MassTransit (IConsumer<T>, ConsumeContext<T>, IPublishEndpoint, ISendEndpointProvider) and Wolverine.Shims.NServiceBus (IHandleMessages<T>, IMessageHandlerContext, IMessageSession, IEndpointInstance, IUniformSession, ITransactionalSession) that delegate to Wolverine's IMessageBus/IMessageContext
  • All shim handler interfaces extend IWolverineHandler for automatic handler discovery — no explicit registration calls needed for IConsumer<T> or IHandleMessages<T> handlers
  • Code generation variable sources are auto-registered in WolverineOptions so ConsumeContext<T> and IMessageHandlerContext are resolved inline without service location
  • MessageBus directly implements IPublishEndpoint and ISendEndpointProvider via a partial class
  • Added [WolverineMessageWrapper] attribute and updated MethodInfoExtensions.MessageType() to unwrap generic wrapper types (e.g. ConsumeContext<T>T) for correct message type discovery
  • Updated migration documentation with auto-discovery notes and handler discovery links

Closes #2202

Test plan

  • 72 shim tests pass (unit tests for all delegation + end-to-end integration tests for both MassTransit and NServiceBus handlers with cascading messages)
  • All 1122 CoreTests pass
  • Verify docs render correctly in VitePress

🤖 Generated with Claude Code

…2202

Add shim interfaces in Wolverine.Shims.MassTransit (IConsumer<T>,
ConsumeContext<T>, IPublishEndpoint, ISendEndpointProvider) and
Wolverine.Shims.NServiceBus (IHandleMessages<T>, IMessageHandlerContext,
IMessageSession, IEndpointInstance, IUniformSession, ITransactionalSession)
that delegate to Wolverine's IMessageBus/IMessageContext.

All shim handler interfaces extend IWolverineHandler for automatic discovery.
Code generation variable sources are auto-registered in WolverineOptions so
ConsumeContext<T> and IMessageHandlerContext are resolved inline without
service location. MessageBus directly implements IPublishEndpoint and
ISendEndpointProvider via a partial class.

Added [WolverineMessageWrapper] attribute and updated MethodInfoExtensions
to unwrap generic wrapper types (e.g. ConsumeContext<T> -> T) for correct
message type discovery.

Includes 72 tests (unit + end-to-end) and updated migration documentation
with auto-discovery notes and handler discovery links.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

Shim Interfaces for MassTransit, NServiceBus, Rebus, MediatR conversions

1 participant