Modular .NET libraries
Chatter
Same handlers. Any broker.
Modular .NET libraries for domain-driven Web APIs and microservices: an in-process CQRS core with technology-agnostic brokered messaging.
dotnet add package Chatter.CQRSScroll to tour Message City
01 · The problem
Every service ends up wiring its own plumbing.
A controller starts with one business rule. Then validation, logging, transactions and retries arrive, copied from the last controller.
When services need to talk, broker SDK code (clients, queue names, serializers) moves into the domain itself. Each building grows its own machinery and its own pipes, and changing brokers means rewiring the city.
Chatter separates what a service does from how its messages travel.
02 · Chatter.CQRS
Inside a service: one dispatcher, many small rooms.
Every message enters through the Message Dispatcher, which finds the right handler by message type. Handlers are small classes, registered by assembly scanning.
- Command goes to exactly one handler and changes state.
- Event reaches every handler that subscribes: zero, one or many.
- Query goes out through the Query Dispatcher and comes back with a Read Model .
The conveyor is the Command Pipeline: ordered behaviors that wrap every Command handler, so logging, unit of work and inbox checks live in one place. A Message Context travels with each dispatch.
builder.Services.AddChatterCqrs(
builder.Configuration,
typeof(Program).Assembly);
public class PlaceOrderHandler
: IMessageHandler<PlaceOrder>
{
public Task Handle(PlaceOrder message,
IMessageHandlerContext context)
{
// change state
return Task.CompletedTask;
}
}
Chatter.CQRS docs ↗
03 · Chatter.MessageBrokers
Leave by the dock. Arrive at a handler you already wrote.
A handler publishes with context.Publish(...). On its own the External Dispatcher does nothing; AddMessageBrokers() replaces it, and the message leaves through the dispatch dock.
At the next building a Brokered Message Receiver is on duty: a hosted service, one per message type. It hands each received message to your existing handler.
The [BrokeredMessage] label carries the sending and receiving paths, so handlers never name a queue or a topic.
[BrokeredMessage(sendingPath: "orders",
receivingPath: "orders")]
public class OrderPlaced : IEvent { ... }
// inside PlaceOrderHandler
await context.Publish(new OrderPlaced { ... });
Chatter.MessageBrokers docs ↗
04 · Transports
Swap the roads. Keep the buildings.
Chatter.MessageBrokers ships no transport of its own. Choose one; your handlers, messages and labels stay as they are.
Azure Service Bus Auth
At the gate, a gatekeeper checks a Microsoft Entra ID token, managed identity included. No connection-string secret waits under the mat.
Transports provision nothing. You create the queues, topics, exchanges and Service Broker objects; Chatter drives them.
05 · Reliability
A mailroom that writes it down before it ships.
- Outbox. The state change and an Outbox record are saved in one transaction. The message is published from that store after commit.
- Inbox. The receiving desk records each handled message, and deduplicates redelivered commands: a parcel it has already seen is shelved without running the handler again.
06 · Recovery
When a delivery fails.
- Retry runs the handler again, with no delay, a constant delay or an exponential one.
- Circuit Breaker lowers the barrier after repeated failures and stops processing. Once it has cooled, it admits a trial before the road reopens.
- Error Queue. A message whose delivery count reaches its receive limit is deadlettered and sent to its Error Queue.
07 · Chatter.SqlChangeFeed
Tables that announce their own changes.
Point it at a SQL Server table. Each insert, update and delete arrives at your handlers as a strongly typed event, carried over SQL Server Service Broker.
- RowInsertedEvent
- RowUpdatedEvent
- RowDeletedEvent
08 · Diagnostics
A control tower that stays dark until you ask.
Tracing and metrics use ActivitySource and Meter from the .NET base class library. Nothing is emitted until your application subscribes, with OpenTelemetry or any listener.
No listener: the tower is dark and nothing is emitted.
09 · City map
The whole city, district by district.
Each package is a district you add when you need it. The foundation sits in front; everything else is built on top of it. Tap a district.
Start with the foundation.
Add Chatter.CQRS, then Chatter.MessageBrokers and one transport when your services need to talk.
dotnet add package Chatter.CQRS