Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Simplify rabbitmq explicit binding - #9911

#9911
Merged
PascalSenn merged 39 commits into
mainChilliCream/graphql-platform:mainfrom
pse/rework-rabbitmq-explicit-bindingChilliCream/graphql-platform:pse/rework-rabbitmq-explicit-bindingCopy head branch name to clipboard
Jun 21, 2026
Merged

Simplify rabbitmq explicit binding#9911
PascalSenn merged 39 commits into
mainChilliCream/graphql-platform:mainfrom
pse/rework-rabbitmq-explicit-bindingChilliCream/graphql-platform:pse/rework-rabbitmq-explicit-bindingCopy head branch name to clipboard

Conversation

@PascalSenn

Copy link
Copy Markdown
Member
  • rework explicity binding of rabbitmq
  • Add bus interceptor functionality to IMessageBusBuilder and related classes

Copilot AI review requested due to automatic review settings June 14, 2026 09:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors transport routing/binding to better support explicit binding (especially for RabbitMQ), adds transport selection controls for outbound routes (OnTransport, default transport validation), and introduces a bus interceptor registration API intended to hook into topology finalization.

Changes:

  • Added transport-selection metadata to outbound routes (TransportName, HasExplicitDestination) plus build-time validation for default transport and OnTransport invariants.
  • Introduced queue-/type-level auto-bind and explicit bind intents (AutoBind, BindFrom) and materialized these intents during receive topology discovery across RabbitMQ/Postgres/InMemory.
  • Added snapshot-based topology assertions and expanded test coverage across transports (including “unified queue” front door behavior and publish endpoint overrides).

Reviewed changes

Copilot reviewed 198 out of 198 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/Mocha/src/Mocha/Builder/MessageBusBuilder.cs Builds interceptor list feature; adds transport configuration validation.
src/Mocha/src/Mocha/Builder/MessageBusBuilder.Interceptors.cs Adds AddBusInterceptor registration APIs and interceptor ordering logic.
src/Mocha/src/Mocha/Abstractions/IMessageBusBuilder.cs Exposes bus interceptor registration API on the builder abstraction.
src/Mocha/src/Mocha/Interceptors/BusInterceptor.cs Defines interceptor hooks for topology lifecycle.
src/Mocha/src/Mocha/Interceptors/BusInterceptorFeature.cs Stores resolved interceptor list as a bus feature.
src/Mocha/src/Mocha/Interceptors/BusInterceptorRegistration.cs Internal model for interceptor registrations.
src/Mocha/src/Mocha/Interceptors/IBusInterceptorTopologyContext.cs Context interface for interceptor topology hooks.
src/Mocha/src/Mocha/Middlewares/DefaultMessageBus.cs Adds PublishOptions.Endpoint override routing to dispatch endpoint.
src/Mocha/src/Mocha/Execution/PublishOptions.cs Adds Endpoint property for publish override.
src/Mocha/src/Mocha/MessageTypes/OutboundRoute.cs Adds HasExplicitDestination + TransportName tracking.
src/Mocha/src/Mocha/MessageTypes/IMessageRouter.cs Switches outbound transport selection to MessagingTransportSelection.
src/Mocha/src/Mocha/MessageTypes/Descriptors/IOutboundRouteDescriptor.cs Adds OnTransport(string) API.
src/Mocha/src/Mocha/MessageTypes/Descriptors/OutboundRouteDescriptor.cs Implements OnTransport(string) storing transport override.
src/Mocha/src/Mocha/MessageTypes/Configurations/OutboundRouteConfiguration.cs Stores TransportName on route configuration.
src/Mocha/src/Mocha/MessageTypes/Extensions/OutboundRouteDescriptorExtensions.cs Documents neutral-scheme addressing constraints in multi-transport setups.
src/Mocha/src/Mocha/Transport/MessagingTransportDescriptor.cs Adds transport-scope AutoBind(bool) to descriptor.
src/Mocha/src/Mocha/Transport/MessagingTransportConfiguration.cs Adds tri-state AutoBind and expands default transport documentation.
src/Mocha/src/Mocha/Transport/MessagingTransport.cs Exposes ConsumerBindingMode, AutoBind, IsDefaultTransport on transports.
src/Mocha/src/Mocha/Consumers/ConsumerBindingMode.cs Reorders binding mode enum (now implicit-first).
src/Mocha/src/Mocha/Endpoints/ReceiveEndpoint.cs Adds OnDiscoverTopology hook prior to convention discovery.
src/Mocha/src/Mocha/Endpoints/ReceiveEndpoint~1.cs Plumbs typed OnDiscoverTopology into generic endpoint base.
src/Mocha/src/Mocha/Endpoints/ReceiveTypeBindIntent.cs Adds intent models for per-type and bind-from declarations.
src/Mocha/src/Mocha/Endpoints/Configurations/ReceiveEndpointConfiguration.cs Adds queue-scope AutoBind, per-type binds, and queue-level bind-from intents.
src/Mocha/src/Mocha/Endpoints/Descriptors/IReceiveEndpointDescriptor.cs Adds Receives<T>(configure), AutoBind, and BindFrom APIs.
src/Mocha/src/Mocha/Endpoints/Descriptors/IReceiveTypeBindDescriptor.cs Adds per-type auto-bind and bind-from fluent API.
src/Mocha/src/Mocha/Endpoints/Descriptors/ReceiveEndpointDescriptor.cs Implements per-type configure overload and merges type bind intents.
src/Mocha/src/Mocha/Endpoints/Descriptors/ReceiveTypeBindDescriptor.cs Collects per-type bind intents and resolves implicit vs explicit AutoBind.
src/Mocha/src/Mocha/Sagas/SagaTransition.cs Removes transition AutoProvision state.
src/Mocha/src/Mocha/Sagas/Saga.Initialization.cs Updates saga transition initialization accordingly.
src/Mocha/src/Mocha/Sagas/Saga.cs Removes AutoProvision from saga descriptions.
src/Mocha/src/Mocha/Sagas/Descriptors/ISagaTransitionDescriptor.cs Removes AutoProvision(...) from saga transition descriptor API.
src/Mocha/src/Mocha/Sagas/Descriptors/SagaTransitionDescriptor.cs Removes AutoProvision(...) implementation.
src/Mocha/src/Mocha/Sagas/Definitions/SagaTransitionConfiguration.cs Removes AutoProvision from transition configuration.
src/Mocha/src/Mocha/Descriptions/SagaTransitionDescription.cs Removes AutoProvision from transition description record.
src/Mocha/src/Mocha.Transport.RabbitMQ/RabbitMQReceiveEndpoint.cs Materializes queue and bind-from intents into RabbitMQ topology.
src/Mocha/src/Mocha.Transport.RabbitMQ/Conventions/RabbitMQDefaultReceiveEndpointConvention.cs Builds typed satellite endpoints (verbatim names, disable flags, auto-provision inheritance).
src/Mocha/src/Mocha.Transport.RabbitMQ/Configurations/RabbitMQReceiveEndpointConfiguration.cs Adds typed satellite config and queue-specific durable/args/autoprovision fields.
src/Mocha/src/Mocha.Transport.RabbitMQ/Configurations/RabbitMQSatelliteConfiguration.cs Adds typed satellite configuration model (name/disable/autoprovision).
src/Mocha/src/Mocha.Transport.RabbitMQ/Configurations/RabbitMQDispatchEndpointConfiguration.cs Adds dispatch-queue auto-provision override.
src/Mocha/src/Mocha.Transport.RabbitMQ/Topology/RabbitMQTopologyShapeConflictException.cs Adds explicit exception for conflicting declared vs convention shapes.
src/Mocha/src/Mocha.Transport.RabbitMQ/Topology/RabbitMQTopologyProvenance.cs Adds provenance constants for declared/convention/endpoint topology nodes.
src/Mocha/src/Mocha.Transport.RabbitMQ/Topology/Descriptors/RabbitMQQueueDescriptor.cs Marks declared queue provenance on descriptor-created queues.
src/Mocha/src/Mocha.Transport.RabbitMQ/Topology/Descriptors/RabbitMQExchangeDescriptor.cs Marks declared exchange provenance on descriptor-created exchanges.
src/Mocha/src/Mocha.Transport.RabbitMQ/Topology/Descriptors/RabbitMQBindingDescriptor.cs Marks declared binding provenance on descriptor-created bindings.
src/Mocha/src/Mocha.Transport.RabbitMQ/Topology/Descriptors/IRabbitMQExchangeContributionDescriptor.cs Adds interface for partial exchange contribution (publish/send).
src/Mocha/src/Mocha.Transport.RabbitMQ/Topology/Configurations/RabbitMQQueueConfiguration.cs Adds provenance metadata to queue config.
src/Mocha/src/Mocha.Transport.RabbitMQ/Topology/Configurations/RabbitMQExchangeConfiguration.cs Adds provenance metadata defaulting to convention.
src/Mocha/src/Mocha.Transport.RabbitMQ/Topology/Configurations/RabbitMQBindingConfiguration.cs Adds provenance metadata defaulting to convention.
src/Mocha/src/Mocha.Transport.RabbitMQ/RabbitMQPublishExchangeFeature.cs Stores publish-exchange partial declaration as a feature.
src/Mocha/src/Mocha.Transport.RabbitMQ/RabbitMQSendExchangeFeature.cs Stores send-exchange partial declaration as a feature.
src/Mocha/src/Mocha.Transport.RabbitMQ/RabbitMQMessageTypeExtensions.cs Adds PublishExchange/SendExchange message type extensions.
src/Mocha/src/Mocha.Transport.RabbitMQ/Descriptors/IRabbitMQReceiveEndpointDescriptor.cs Adds typed satellites + bind/auto-bind APIs to RabbitMQ receive descriptors.
src/Mocha/src/Mocha.Transport.RabbitMQ/Descriptors/IRabbitMQMessagingTransportDescriptor.cs Adds AutoBind and unified Queue(...) front door APIs.
src/Mocha/src/Mocha.Transport.Postgres/PostgresMessagingTransport.cs Uses destination resolver for endpoint configuration + neutral scheme claiming rules.
src/Mocha/src/Mocha.Transport.Postgres/PostgresReceiveEndpoint.cs Materializes queue/topic + bind-from intents into Postgres topology.
src/Mocha/src/Mocha.Transport.Postgres/Conventions/PostgresDispatchEndpointTopologyConvention.cs Ensures bridge topics in implicit mode via resolver.
src/Mocha/src/Mocha.Transport.Postgres/Conventions/PostgresDefaultReceiveEndpointConvention.cs Adds typed satellite naming/disable behavior.
src/Mocha/src/Mocha.Transport.Postgres/Configurations/PostgresReceiveEndpointConfiguration.cs Adds typed satellite configuration to receive endpoints.
src/Mocha/src/Mocha.Transport.Postgres/Configurations/PostgresSatelliteConfiguration.cs Adds typed satellite config model (name/disable).
src/Mocha/src/Mocha.Transport.Postgres/Topology/PostgresMessagingTopology.cs Allows merging queue/topic duplicates (strengthening AutoProvision).
src/Mocha/src/Mocha.Transport.Postgres/Topology/PostgresQueue.cs Adds merge behavior for queue provisioning settings.
src/Mocha/src/Mocha.Transport.Postgres/Topology/PostgresTopic.cs Adds merge behavior for topic provisioning settings.
src/Mocha/src/Mocha.Transport.Postgres/Descriptors/IPostgresReceiveEndpointDescriptor.cs Adds typed satellites + bind/auto-bind APIs to Postgres receive descriptors.
src/Mocha/src/Mocha.Transport.Postgres/Descriptors/IPostgresMessagingTransportDescriptor.cs Adds AutoBind and unified Queue(...) front door APIs.
src/Mocha/src/Mocha.Transport.Postgres/Descriptors/IPostgresQueueEndpointDescriptor.cs Adds unified queue endpoint descriptor (pinned identity).
src/Mocha/src/Mocha.Transport.InMemory/InMemoryMessagingTransport.cs Uses destination resolver for endpoint configuration + neutral scheme claiming rules.
src/Mocha/src/Mocha.Transport.InMemory/InMemoryReceiveEndpoint.cs Materializes queue/topic + bind-from intents into in-memory topology.
src/Mocha/src/Mocha.Transport.InMemory/Topology/InMemoryMessagingTopology.cs Returns existing queue/topic on duplicates instead of throwing.
src/Mocha/src/Mocha.Transport.InMemory/Descriptors/InMemoryReceiveEndpointDescriptor.cs Adds queue identity pinning and bind/auto-bind APIs.
src/Mocha/src/Mocha.Transport.InMemory/Descriptors/IInMemoryReceiveEndpointDescriptor.cs Adds bind/auto-bind APIs to in-memory receive descriptor interface.
src/Mocha/src/Mocha.Transport.InMemory/Descriptors/IInMemoryMessagingTransportDescriptor.cs Adds AutoBind and unified Queue(...) front door APIs.
src/Mocha/src/Mocha.Transport.InMemory/Descriptors/IInMemoryQueueEndpointDescriptor.cs Adds unified queue endpoint descriptor (pinned identity).
src/Mocha/test/Mocha.Transport.RabbitMQ.Tests/Mocha.Transport.RabbitMQ.Tests.csproj Adds CookieCrumble snapshot test project references/analyzers.
src/Mocha/test/Mocha.Transport.RabbitMQ.Tests/Helpers/RabbitMQDescribeSnapshot.cs Adds deterministic JSON projection for RabbitMQ topology snapshots.
src/Mocha/test/Mocha.Transport.RabbitMQ.Tests/RabbitMQReceiveEndpointTests.cs Updates tests to typed satellites (ErrorQueue/SkippedQueue).
src/Mocha/test/Mocha.Transport.RabbitMQ.Tests/Descriptors/RabbitMQHandlerBindingTests.cs Adds CookieCrumble snapshot assertions for binding modes and auto-bind behavior.
src/Mocha/test/Mocha.Transport.RabbitMQ.Tests/Descriptors/RabbitMQQueueFrontDoorTests.cs Adds unified Queue(...) endpoint convergence tests.
src/Mocha/test/Mocha.Transport.RabbitMQ.Tests/Routing/RabbitMQTransportResolverWiringTests.cs Adds wiring tests for resolver-based dispatch endpoint configuration.
src/Mocha/test/Mocha.Transport.RabbitMQ.Tests/**/snapshots/*.snap Adds/updates many RabbitMQ topology snapshots reflecting new discovery/merge behavior.
src/Mocha/test/Mocha.Transport.Postgres.Tests/Helpers/PostgresDescribeSnapshot.cs Adds deterministic JSON projection for Postgres topology snapshots.
src/Mocha/test/Mocha.Transport.Postgres.Tests/PostgresSatelliteTests.cs Adds typed satellite behavior snapshots for Postgres.
src/Mocha/test/Mocha.Transport.Postgres.Tests/PostgresReceiveEndpointBindFromTests.cs Adds BindFrom intent materialization + routing key rejection tests.
src/Mocha/test/Mocha.Transport.Postgres.Tests/Routing/PostgresTransportResolverWiringTests.cs Adds wiring tests for resolver-based dispatch endpoint configuration.
src/Mocha/test/Mocha.Transport.Postgres.Tests/Routing/PostgresDestinationResolverTests.cs Adds resolver unit tests for convention vs explicit destinations.
src/Mocha/test/Mocha.Transport.Postgres.Tests/Descriptors/PostgresDescriptorTests.cs Updates descriptor tests for typed satellites and auto-bind defaults.
src/Mocha/test/Mocha.Transport.Postgres.Tests/Topology/PostgresMessageTypeExtensionTests.cs Updates test stub to satisfy new OnTransport route API.
src/Mocha/test/Mocha.Transport.Postgres.Tests/**/snapshots/*.snap Adds Postgres topology snapshots for new behavior.
src/Mocha/test/Mocha.Transport.InMemory.Tests/Topology/InMemoryMessagingTopologyTests.cs Updates topology duplicate behavior tests (return existing).
src/Mocha/test/Mocha.Transport.InMemory.Tests/InMemoryReceiveEndpointBindFromTests.cs Adds routing key rejection tests for BindFrom on in-memory transport.
src/Mocha/test/Mocha.Transport.InMemory.Tests/InMemoryHandlerClaimTests.cs Adds tests for explicit binding mode and claim convergence behavior.
src/Mocha/test/Mocha.Transport.InMemory.Tests/Descriptors/InMemoryUnifiedQueueTests.cs Adds unified queue delivery and entity-only lowering tests.
src/Mocha/test/Mocha.Transport.InMemory.Tests/Descriptors/InMemoryDescriptorTests.cs Adds auto-bind default/override tests.
src/Mocha/test/Mocha.Transport.InMemory.Tests/Behaviors/RequestReplyTests.cs Adds request/reply regression test under explicit binding mode.
src/Mocha/test/Mocha.Transport.InMemory.Tests/Behaviors/PublishOptionsEndpointTests.cs Adds behavior test for PublishOptions.Endpoint override.
src/Mocha/test/Mocha.Transport.InMemory.Tests/Topology/snapshots/*.snap Adds/updates in-memory topology snapshots for auto-bind suppression behavior.
src/Mocha/test/Mocha.Tests/MessageTypes/OutboundRouteTests.cs Adds tests for HasExplicitDestination semantics.
src/Mocha/test/Mocha.Tests/MessageTypes/NeutralSchemeResolutionTests.cs Adds tests for neutral-scheme default transport claim behavior.
src/Mocha/test/Mocha.Tests/MessageTypes/MessageBusBuilderTransportValidationTests.cs Adds build-time transport invariant validation tests + snapshots.
src/Mocha/test/Mocha.Tests/Endpoints/ReceiveTypeBindDescriptorTests.cs Adds tests for per-type bind intent accumulation and auto-bind resolution rules.
src/Mocha/test/Mocha.Tests/Conventions/DefaultNamingConventionsTests.cs Adds kebab-casing test for error-queue-like pascal input.
src/Mocha/test/Mocha.Sagas.Tests/SagaExecutionTests.cs Removes saga transition auto-provision assertion.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Mocha/src/Mocha/Consumers/ConsumerBindingMode.cs Outdated
Comment thread src/Mocha/src/Mocha/Endpoints/Descriptors/ReceiveTypeBindDescriptor.cs Outdated
Comment thread src/Mocha/src/Mocha/Endpoints/Descriptors/ReceiveEndpointDescriptor.cs Outdated
Comment thread src/Mocha/src/Mocha.Transport.RabbitMQ/RabbitMQReceiveEndpoint.cs Outdated
Comment thread src/Mocha/src/Mocha/Builder/MessageBusBuilder.cs Outdated
Comment thread src/Mocha/test/Mocha.Tests/MessageTypes/OutboundRouteTests.cs Fixed
Comment thread src/Mocha/src/Mocha/Transport/MessagingTransportSelection.cs Fixed
Comment thread src/Mocha/src/Mocha/Transport/MessagingTransport.Lifecyle.cs Fixed
Comment thread src/Mocha/src/Mocha/Transport/MessagingTransportSelection.cs Fixed
Comment thread src/Mocha/src/Mocha/Transport/MessagingTransportSelection.cs Fixed
Comment thread src/Mocha/src/Mocha/Transport/MessagingTransportSelection.cs Fixed
@PascalSenn
PascalSenn force-pushed the pse/rework-rabbitmq-explicit-binding branch from c70351e to c2fd5e7 Compare June 14, 2026 10:45
- Removed deprecated RabbitMQQueueFrontDoorTests and consolidated queue handling logic.
- Updated RabbitMQUnifiedQueueTests to reflect changes in queue naming and binding behavior.
- Adjusted RabbitMQReceiveEndpointBindFromTests to utilize the new unified queue approach.
- Modified RabbitMQReceiveEndpointTests to streamline queue declarations and handlers.
- Enhanced RabbitMQSatelliteTests to ensure proper queue provisioning and consumer attachment.
- Updated snapshots to reflect changes in queue source from "endpoint" to "declared" for clarity.
Comment thread src/Mocha/src/Mocha/Transport/MessagingTransportSelection.cs Fixed
Comment thread src/Mocha/src/Mocha/Transport/MessagingTransportSelection.cs Fixed
Comment thread src/Mocha/src/Mocha/Transport/MessagingTransportSelection.cs Fixed
- Removed BindFrom method from IReceiveEndpointDescriptor and its implementations in RabbitMQ and Postgres transport descriptors.
- Updated ReceiveEndpointConfiguration to eliminate QueueBindFroms property.
- Adjusted ReceiveTypeBindDescriptor to remove BindFrom method and related logic.
- Simplified tests to reflect changes in binding behavior, ensuring that AutoBind settings are correctly applied without explicit BindFrom declarations.
- Cleaned up documentation and comments related to binding behavior across various transport implementations.
Comment thread src/Mocha/src/Mocha/Transport/MessagingTransportSelection.cs Fixed
Comment thread src/Mocha/src/Mocha/Transport/MessagingTransport.Lifecyle.cs Fixed
Comment thread src/Mocha/src/Mocha/Transport/MessagingTransportSelection.cs Fixed
Comment thread src/Mocha/src/Mocha/Transport/MessagingTransportSelection.cs Fixed
- Changed binding method from BindHandlersExplicitly to BindExplicitly across multiple test files to standardize binding behavior.
- Updated snapshot files to reflect changes in RabbitMQ topology descriptions.
- Removed obsolete snapshots that are no longer relevant due to the refactor.
- Adjusted test assertions to ensure they align with the new binding logic.
Comment thread src/Mocha/src/Mocha/Transport/MessagingTransport.Lifecyle.cs Fixed
…onfiguration methods and updating related documentation
- Removed IReceiveEndpointTopologyConvention and IDispatchEndpointTopologyConvention interfaces to simplify the convention model.
- Consolidated topology discovery logic into the RoutingStrategy class.
- Updated DispatchEndpoint and ReceiveEndpoint classes to use the new routing strategy for topology discovery.
- Introduced MessagingSetupContextExtensions for binding routes to endpoints.
- Added UriExtensions for extracting resource names from URIs.
- Enhanced MessagingTransport to support a routing strategy.
- Updated tests to reflect changes in routing and endpoint conventions.
- Improved documentation on binding handlers to endpoints by message type.
…ategy to improve clarity and remove obsolete methods
…ategies to remove obsolete code and improve endpoint configuration clarity
- Removed RabbitMQSatelliteConfiguration class and integrated its properties directly into RabbitMQReceiveEndpointConfiguration.
- Updated IRabbitMQQueueBuilder interface to reflect changes in error and skipped queue handling.
- Modified RabbitMQMessagingTransportDescriptor to handle error and skipped queue routes without relying on the removed class.
- Enhanced RabbitMQQueueBuilder to manage error and skipped queue URIs directly.
- Adjusted RabbitMQRoutingStrategy to ensure proper configuration of error and skipped queues.
- Updated tests to validate new error and skipped queue configurations, ensuring backward compatibility.
- Renamed relevant methods and variables for clarity and consistency with the new configuration approach.
@github-actions github-actions Bot added the 📚 documentation This issue is about working on our documentation. label Jun 18, 2026
Comment thread src/Mocha/test/Mocha.Tests/MessageTypes/OutboundRouteTests.cs Fixed
Comment thread src/Mocha/src/Mocha/MessageTypes/IMessageRouter.cs Fixed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📚 documentation This issue is about working on our documentation. 🌶️ mocha

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.