Swevo.AutoBus
1.0.0
Prefix Reserved
See the version list below for details.
dotnet add package Swevo.AutoBus --version 1.0.0
NuGet\Install-Package Swevo.AutoBus -Version 1.0.0
<PackageReference Include="Swevo.AutoBus" Version="1.0.0" />
<PackageVersion Include="Swevo.AutoBus" Version="1.0.0" />
<PackageReference Include="Swevo.AutoBus" />
paket add Swevo.AutoBus --version 1.0.0
#r "nuget: Swevo.AutoBus, 1.0.0"
#:package Swevo.AutoBus@1.0.0
#addin nuget:?package=Swevo.AutoBus&version=1.0.0
#tool nuget:?package=Swevo.AutoBus&version=1.0.0
AutoBus
Free, MIT-licensed message bus for .NET. No commercial license required — ever.
Why AutoBus?
MassTransit v9 is now a commercial product. AutoBus is a much smaller, focused alternative for the common case: a modular monolith (or a small set of services) that wants reliable pub/sub and point-to-point messaging with retry, without adopting a paid distributed messaging framework. It isn't a drop-in MassTransit replacement — there's no saga state machine engine, no routing slips, no multi-broker rider abstraction — just consumers, publish/send, retry, and (optionally) RabbitMQ.
public sealed class OrderCreated
{
public int OrderId { get; init; }
}
public sealed class SendWelcomeEmail : IConsumer<OrderCreated>
{
public Task Consume(ConsumeContext<OrderCreated> context)
{
// send the email...
return Task.CompletedTask;
}
}
services.AddAutoBus(cfg => cfg.AddConsumer<SendWelcomeEmail>());
// elsewhere:
await messageBus.PublishAsync(new OrderCreated { OrderId = 42 });
Install
dotnet add package Swevo.AutoBus
For cross-process messaging over RabbitMQ:
dotnet add package Swevo.AutoBus.RabbitMQ
Core concepts
IConsumer<TMessage>— implement this for each message type you handle.IMessageBus.PublishAsync— fan-out to every registered consumer for a message type (zero consumers is not an error).IMessageBus.SendAsync— point-to-point; throws if zero or more than one consumer is registered for the message type.- Retry — every consumer invocation runs through a Polly retry pipeline (exponential
backoff, 3 attempts by default). Configure with
cfg.UseRetry(retryCount, baseDelay). - Transports —
InMemoryTransport(default, in-process dispatch) orRabbitMqTransport/RabbitMqConsumerHost(cross-process, viaSwevo.AutoBus.RabbitMQ).
RabbitMQ transport
services.AddAutoBus(cfg => cfg.AddConsumer<SendWelcomeEmail>());
services.AddAutoBusRabbitMq(options =>
{
options.HostName = "localhost";
options.QueuePrefix = "orders-service"; // scopes queue names per service
});
Publishing a message sends it to a fanout exchange named after the message's full type name.
AddAutoBusRabbitMq also registers a hosted RabbitMqConsumerHost that declares and binds a
durable queue for every locally-registered consumer, so the same IConsumer<T> code runs
whether messages arrive in-process or over the broker — call AddAutoBusRabbitMq after
AddAutoBus since it replaces the default in-memory transport.
Using AutoBus from an EF Core transactional outbox
AutoBus's IMessageBus.PublishAsync(object message, Type messageType, CancellationToken)
overload mirrors MassTransit's IPublishEndpoint.Publish(object, Type, CancellationToken)
signature, so it's a drop-in replacement inside an outbox processor loop — see
EFCore.Outbox, which uses AutoBus instead of
MassTransit for exactly this reason.
Design goals
- MIT licensed, forever. No commercial tier, no per-seat fees.
- Small surface area. Consumers, publish/send, retry — no bespoke DSL to learn.
- Same code, two transports. Consumers are written once; swapping
InMemoryTransportforRabbitMqTransportis a one-line DI change.
Roadmap
- Saga/state-machine support and additional broker transports (Azure Service Bus, Amazon SQS) are being considered for future releases, scoped to real demand rather than parity with MassTransit's full feature set.
💼 Need .NET consulting?
I'm the author of AutoBus and a suite of compile-time source generators (AutoWire, AutoMap.Generator) and 28+ Polly v8 resilience packages. I'm available for consulting on Polly v8 resilience, Azure cloud architecture, and clean .NET design.
→ solidqualitysolutions.com · LinkedIn
Also by the same author
🌐 Full suite overview: swevo.github.io
| Package | Description |
|---|---|
| EFCore.Outbox | Transactional outbox pattern for EF Core — pairs naturally with AutoBus. |
| Swevo.AutoAssert | Free, MIT-licensed fluent assertions — alternative to FluentAssertions' commercial license. |
| EFCore.BulkOperations | Free, MIT-licensed bulk insert/update/delete for EF Core. |
| AutoWire | Compile-time DI auto-registration — [Scoped]/[Singleton]/[Transient] generates IServiceCollection registration code. |
| AutoDispatch.Generator | Compile-time CQRS dispatcher — free alternative to MediatR's commercial license. |
License
MIT © Justin Bannister
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
- Polly.Core (>= 8.7.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Swevo.AutoBus:
| Package | Downloads |
|---|---|
|
Swevo.EFCore.Outbox
Transactional outbox pattern for EF Core + AutoBus. Add outbox messages atomically with your domain changes via a SaveChangesInterceptor, then publish them reliably via a background processor. Zero message loss even if the bus is unavailable at save time. |
|
|
Swevo.AutoBus.RabbitMQ
RabbitMQ transport for AutoBus. Publishes messages to a fanout exchange per message type and hosts a background consumer that binds a durable queue for every registered AutoBus consumer, so the same IConsumer<T>/IMessageBus programming model works across process boundaries. |
GitHub repositories
This package is not used by any popular GitHub repositories.
1.0.0: Initial release. IConsumer<T>, IMessageBus (Publish/Send), in-memory transport, Polly retry, DI registration.