Skip to content
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
c2fd5e7
rework explicity binding of rabbitmq
PascalSenn Jun 13, 2026
0776206
Refactor RabbitMQ transport tests to unify queue handling
PascalSenn Jun 14, 2026
bc4d148
Refactor CreateConfiguration method to improve endpoint handling and …
PascalSenn Jun 14, 2026
ef5864d
Refactor to unify queue handling by removing explicit endpoint declar…
PascalSenn Jun 14, 2026
ef97e2e
Refactor receive endpoint binding configuration
PascalSenn Jun 15, 2026
9a79572
Remove obsolete routing topology proposal document
PascalSenn Jun 15, 2026
44ae266
Refactor RabbitMQ binding methods and update snapshots
PascalSenn Jun 15, 2026
0b0b3d1
Refactor receive endpoint binding by removing explicit configuration …
PascalSenn Jun 15, 2026
9c6b175
Refactor messaging transport descriptors by removing explicit queue c…
PascalSenn Jun 15, 2026
f910589
Refactor queue builder interfaces by removing obsolete comments and u…
PascalSenn Jun 16, 2026
4db3c7b
Refactor routing and topology conventions
PascalSenn Jun 17, 2026
0f5e222
Refactor routing strategy interfaces and implementations to remove ob…
PascalSenn Jun 17, 2026
cb81032
Refactor RabbitMQ destination resolution and routing strategy
PascalSenn Jun 17, 2026
20c62ae
Refactor RabbitMQ and Postgres destination resolution and routing str…
PascalSenn Jun 17, 2026
f925480
Refactor RabbitMQ, Postgres, and InMemory conventions and routing str…
PascalSenn Jun 18, 2026
b895aa4
Refactor RabbitMQ Error and Skipped Queue Configuration
PascalSenn Jun 18, 2026
3f1fa00
Refactor error and skipped endpoint handling in PostgreSQL and Rabbit…
PascalSenn Jun 18, 2026
4117f1e
Refactor in-memory, PostgreSQL, and RabbitMQ queue descriptors to use…
PascalSenn Jun 18, 2026
b762c25
Refactor ReceiveEndpoint and features to improve clarity and remove o…
PascalSenn Jun 18, 2026
138ea0c
Refactor transport documentation to enhance clarity and consistency
PascalSenn Jun 18, 2026
1326d99
Refactor in-memory and RabbitMQ transport descriptors to improve clar…
PascalSenn Jun 19, 2026
f3b8986
Refactor RabbitMQ topology snapshots to replace "Source" with "Origin"
PascalSenn Jun 19, 2026
ccc894e
Refactor topology resource management in RabbitMQ and Postgres transp…
PascalSenn Jun 19, 2026
aa4f059
Refactor RabbitMQ and Postgres topology to remove obsolete ApplyOrigi…
PascalSenn Jun 19, 2026
120fbb5
cleanup
PascalSenn Jun 20, 2026
506e099
Refactor Postgres and RabbitMQ routing strategies to remove obsolete …
PascalSenn Jun 20, 2026
1690689
Refactor endpoint configuration to use Uri for fault and skipped endp…
PascalSenn Jun 20, 2026
0991c5b
Change AutoProvision property setter to private for encapsulation
PascalSenn Jun 20, 2026
436f32a
cleanup
PascalSenn Jun 20, 2026
e3920a4
Remove RabbitMQ exchange feature classes and related methods to simpl…
PascalSenn Jun 20, 2026
017935e
Refactor RabbitMQ topology methods to simplify exchange, queue, and b…
PascalSenn Jun 20, 2026
1082d39
Refactor RabbitMQ binding management to simplify binding retrieval an…
PascalSenn Jun 21, 2026
c882ddc
Refactor RabbitMQ topology classes to enhance encapsulation and simpl…
PascalSenn Jun 21, 2026
3c0943a
Refactor RabbitMQMessagingTopology to simplify byte appending logic; …
PascalSenn Jun 21, 2026
a43f1d1
cleanup
PascalSenn Jun 21, 2026
b19b461
Refactor RabbitMQ tests to replace "front door" terminology with "API…
PascalSenn Jun 21, 2026
71d854e
Refactor routing strategies to remove unnecessary default transport c…
PascalSenn Jun 21, 2026
f050a01
Merge branch 'main' into pse/rework-rabbitmq-explicit-binding
PascalSenn Jun 21, 2026
5273841
Refactor RabbitMQ and Postgres transport descriptors to simplify Bind…
PascalSenn Jun 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Mocha/benchmarks/PostgresBenchmark/PostgresBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@
});

// Explicit queue for the Send pattern
t.DeclareQueue("bench-cmd");
t.Endpoint("bench-cmd-ep").Queue("bench-cmd").Handler<BenchmarkCommandHandler>();
t.Queue("bench-cmd").Handler<BenchmarkCommandHandler>();
});
consumerApp = b.Build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@
t.ConnectionString(messagingConnectionString);

// Explicit topology for Send pattern demo
t.DeclareQueue("process-order");
t.Endpoint("process-order-ep").Queue("process-order").Handler<ProcessOrderCommandHandler>();
t.Queue("process-order").Handler<ProcessOrderCommandHandler>();
t.DispatchEndpoint("send-demo").ToQueue("process-order").Send<ProcessOrderCommand>();

// Explicit topology bound by message type instead of handler type. Every handler
// registered for OrderShippedEvent is bound to this endpoint via Receives.
t.DeclareQueue("ship-order");
t.Endpoint("ship-order-ep").Queue("ship-order").Receives<OrderShippedEvent>();
t.Queue("ship-order").Receives<OrderShippedEvent>();
t.DispatchEndpoint("ship-demo").ToQueue("ship-order").Send<OrderShippedEvent>();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
transport.Name("primary");
})
// Second InMemory transport - dedicated to the audit pipeline.
// BindHandlersExplicitly() means only handlers explicitly assigned via
// BindExplicitly() means only handlers explicitly assigned via
// .Handler<T>() on an endpoint descriptor are bound to this transport.
.AddInMemory(transport =>
{
transport.Name("audit");
transport.BindHandlersExplicitly();
transport.BindExplicitly();

// Route AuditHandler exclusively to this transport's endpoint.
// OrderPlacedHandler is NOT bound here - it runs on the primary transport.
Expand Down
6 changes: 3 additions & 3 deletions src/Mocha/src/Examples/Transports/RabbitMQ/RabbitMQ.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
.AddEventHandler<OrderPlacedHandler>()
.AddRabbitMQ(transport =>
{
// BindHandlersExplicitly() means you control exactly which handlers
// BindExplicitly() means you control exactly which handlers
// go to which endpoints. Auto-discovery is disabled.
transport.BindHandlersExplicitly();
transport.BindExplicitly();

// Configure a receive endpoint with a quorum queue for production use.
// Quorum queues replicate across nodes via Raft consensus and are the
// recommended queue type since RabbitMQ 4.0 (classic mirrored queues removed).
transport.Endpoint("order-processing")
transport
.Queue("orders.processing")
// MaxPrefetch controls how many unacknowledged messages RabbitMQ
// delivers at once. For quorum queues, avoid prefetch=1 as it
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
namespace Mocha.Transport.InMemory;

/// <summary>
/// Configuration collected by <see cref="IInMemoryQueueDescriptor"/>.
/// </summary>
public sealed class InMemoryQueueDescriptorConfiguration : MessagingConfiguration
{
internal InMemoryQueueDescriptorConfiguration(string name)
{
Name = name;
Queue = new InMemoryQueueConfiguration { Name = name, Origin = TopologyOrigin.Declared };
}

/// <summary>
/// Gets or sets the queue name, which also serves as the default receive endpoint name.
/// </summary>
public string? Name { get; set; }

/// <summary>
/// Gets the backing queue topology configuration.
/// </summary>
public InMemoryQueueConfiguration Queue { get; }

/// <summary>
/// Gets the consumer identity types explicitly bound to this queue.
/// </summary>
public List<Type> ConsumerIdentities { get; } = [];

/// <summary>
/// Gets the message types received by this queue.
/// </summary>
public List<Type> ReceivedMessageTypes { get; } = [];

/// <summary>
/// Gets or sets the queue-scoped bind mode.
/// </summary>
public MessagingBindMode? BindMode { get; set; }

/// <summary>
/// Gets or sets the receive endpoint kind when this queue materializes an endpoint.
/// </summary>
public ReceiveEndpointKind? Kind { get; set; }

/// <summary>
/// Gets or sets the receive endpoint maximum concurrency.
/// </summary>
public int? MaxConcurrency { get; set; }

/// <summary>
/// Gets the receive middleware configurations applied when this queue materializes an endpoint.
/// </summary>
public List<ReceiveMiddlewareConfiguration> ReceiveMiddlewares { get; } = [];

/// <summary>
/// Gets the receive pipeline modifiers applied when this queue materializes an endpoint.
/// </summary>
public List<Action<List<ReceiveMiddlewareConfiguration>>> ReceivePipelineModifiers { get; } = [];

/// <summary>
/// Gets the source topic bindings declared from this queue descriptor.
/// </summary>
public List<Uri> SourceBindings { get; } = [];
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public InMemoryTransportConfiguration()
{
Name = DefaultName;
Schema = DefaultSchema;
RoutingStrategyFactory = static _ => new InMemoryRoutingStrategy();
}

public List<InMemoryTopicConfiguration> Topics { get; set; } = [];
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ public interface IInMemoryMessagingTransportDescriptor : IMessagingTransportDesc
new IInMemoryMessagingTransportDescriptor Schema(string schema);

/// <inheritdoc />
new IInMemoryMessagingTransportDescriptor BindHandlersImplicitly();
new IInMemoryMessagingTransportDescriptor BindImplicitly();

/// <inheritdoc />
new IInMemoryMessagingTransportDescriptor BindHandlersExplicitly();
new IInMemoryMessagingTransportDescriptor BindExplicitly();

/// <summary>
/// Declares or retrieves a receive endpoint with the specified name.
Expand All @@ -37,22 +37,22 @@ public interface IInMemoryMessagingTransportDescriptor : IMessagingTransportDesc
/// </summary>
/// <param name="name">The topic name.</param>
/// <returns>A descriptor for further configuring the topic.</returns>
IInMemoryTopicDescriptor DeclareTopic(string name);
IInMemoryTopicTopologyDescriptor DeclareTopic(string name);

/// <summary>
/// Declares a queue in the in-memory topology.
/// </summary>
/// <param name="name">The queue name.</param>
/// <returns>A descriptor for further configuring the queue.</returns>
IInMemoryQueueDescriptor DeclareQueue(string name);
/// <returns>A queue topology descriptor for further configuring the queue.</returns>
IInMemoryQueueTopologyDescriptor DeclareQueue(string name);

/// <summary>
/// Declares a binding that routes messages from a topic to a queue in the in-memory topology.
/// </summary>
/// <param name="topic">The source topic name.</param>
/// <param name="queue">The destination queue name.</param>
/// <returns>A descriptor for further configuring the binding.</returns>
IInMemoryBindingDescriptor DeclareBinding(string topic, string queue);
IInMemoryBindingTopologyDescriptor DeclareBinding(string topic, string queue);

/// <inheritdoc />
new IInMemoryMessagingTransportDescriptor Name(string name);
Expand All @@ -63,6 +63,9 @@ public interface IInMemoryMessagingTransportDescriptor : IMessagingTransportDesc
/// <inheritdoc />
new IInMemoryMessagingTransportDescriptor IsDefaultTransport();

/// <inheritdoc cref="IMessagingTransportDescriptor.UseRoutingStrategy(Func{IServiceProvider, RoutingStrategy})" />
new IInMemoryMessagingTransportDescriptor UseRoutingStrategy(Func<IServiceProvider, RoutingStrategy> factory);

/// <inheritdoc />
new IInMemoryMessagingTransportDescriptor UseDispatch(
DispatchMiddlewareConfiguration configuration,
Expand Down Expand Up @@ -92,4 +95,13 @@ IMessagingTransportHandlerDescriptor<IInMemoryReceiveEndpointDescriptor> Handler
/// <returns>A configurator that allows configuring the consumer's receive endpoint.</returns>
IMessagingTransportConsumerDescriptor<IInMemoryReceiveEndpointDescriptor> Consumer<TConsumer>()
where TConsumer : class, IConsumer;

/// <summary>
/// Gets or creates the queue descriptor for the given queue name. The queue is declared
/// in the topology and has a receive endpoint using the same identity. Calling this method
/// multiple times with the same name returns the same descriptor.
/// </summary>
/// <param name="name">The queue name. Also serves as the endpoint identity.</param>
/// <returns>A queue descriptor for further configuration.</returns>
IInMemoryQueueDescriptor Queue(string name);
}
Loading
Loading