Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

SlimMessageBus

> 数据库
Open source

Lightweight message bus interface for .NET (pub/sub and request-response) with transport plugins for popular message brokers.

651 stars0 likes2 views
WebsiteGitHub

About

Lightweight message bus interface for .NET (pub/sub and request-response) with transport plugins for popular message brokers.

SlimMessageBus

SlimMessageBus is a lightweight, flexible, and extensible messaging framework for .NET, supporting multiple message brokers, including Kafka, RabbitMQ, Azure EventHubs, MQTT, Redis Pub/Sub, and more. It simplifies asynchronous communication and integrates seamlessly with modern .NET applications.

See how to migrate from MediatR or MassTransit

Quick Start

Installation

bash
dotnet add package SlimMessageBus
# Add specific transport provider, e.g. Kafka
dotnet add package SlimMessageBus.Host.Kafka
# Add serialization plugin
dotnet add package SlimMessageBus.Host.Serialization.SystemTextJson

Basic Usage

Publishing Messages

csharp
IMessageBus bus; // injected

public record OrderCreatedEvent(int OrderId);

await bus.Publish(new OrderCreatedEvent(123));

Consuming Messages

csharp
public class OrderCreatedEventConsumer : IConsumer
{
    public async Task OnHandle(OrderCreatedEvent message, CancellationToken cancellationToken)
    {
        // Handle the event
    }
}

Request-Response Example

Sending a Request

csharp
public record CreateCustomerCommand(string Name) : IRequest;
public record CreateCustomerCommandResult(Guid CustomerId);

var result = await bus.Send(new CreateCustomerCommand("John Doe"));

Handling a Request

csharp

public class CreateCustomerCommandHandler : IRequestHandler
{
    public async Task OnHandle(CreateCustomerCommand request, CancellationToken cancellationToken)
    {
        // Create customer logic
        return new(Guid.NewGuid());
    }
}

Configuration Example

…

The configuration can be modularized (for modular monoliths).

Documentation

  • Introduction
  • Transports:
    • Amazon SQS/SNS
    • Apache Kafka
    • Azure EventHubs
    • Azure ServiceBus
    • Google Cloud Pub/Sub
    • Hybrid
    • MQTT
    • Memory
    • NATS
    • PostgreSQL
    • RabbitMQ
    • Redis
    • SQL
  • Plugins:
    • Serialization
    • Transactional Outbox
      • MongoDB
    • Validation using FluentValidation
    • AsyncAPI specification generation
    • Consumer Circuit Breaker
  • Samples
  • Use Cases

NuGet Packages

Name Description NuGet
SlimMessageBus The core API for SlimMessageBus
Transports
.Host.AmazonSQS Transport provider for Amazon SQS / SNS
.Host.AzureEventHub Transport provider for Azure Event Hubs
.Host.AzureServiceBus Transport provider for Azure Service Bus
.Host.GooglePubSub Transport provider for Google Cloud Pub/Sub
.Host.Kafka Transport provider for Apache Kafka
.Host.MQTT Transport provider for MQTT
.Host.Memory Transport provider implementation for in-process (in memory) message passing (no messaging infrastructure required)
.Host.NATS Transport provider for NATS
.Host.PostgreSql Transport provider implementation for PostgreSQL database message passing
.Host.RabbitMQ Transport provider for RabbitMQ
.Host.Redis Transport provider for Redis
.Host.Sql Transport provider implementation for SQL Server / Azure SQL database message passing
Serialization
.Host.Serialization.Json Serialization plugin for JSON (Newtonsoft.Json library)
.Host.Serialization.SystemTextJson Serialization plugin for JSON (System.Text.Json library)
.Host.Serialization.Avro Serialization plugin for Avro (Apache.Avro library)
.Host.Serialization.Hybrid Plugin that delegates serialization to other serializers based on message type
.Host.Serialization.GoogleProtobuf Serialization plugin for Google Protobuf
Plugins
.Host.AspNetCore Integration for ASP.NET Core
.Host.Interceptor Core interface for interceptors
.Host.FluentValidation Validation for messages based on FluentValidation
.Host.Outbox.PostgreSql Transactional Outbox using PostgreSQL
.Host.Outbox.PostgreSql.DbContext Transactional Outbox using PostgreSQL with EF DataContext integration
.Host.Outbox.Sql Transactional Outbox using MSSQL
.Host.Outbox.Sql.DbContext Transactional Outbox using MSSQL with EF DataContext integration
.Host.Outbox.MongoDb (beta) Transactional Outbox using MongoDB
.Host.AsyncApi AsyncAPI specification generation via Saunter
.Host.CircuitBreaker.HealthCheck Consumer circuit breaker based on health checks

Typically the application layers (domain model, business logic) only need to depend on SlimMessageBus which is the facade, and ultimately the application hosting

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C#apache-kafkaavroazureazure-event-hubs

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库