Skip to main content

Choosing a Transport

Excalibur supports five production transports plus two built-in ones for development and scheduling. Each transport has different strengths, and the right choice depends on your throughput needs, ordering requirements, cloud provider, and operational preferences.

This guide helps you make that decision and shows how to start simple and evolve.

Before You Start​

  • .NET 10.0
  • Install the core package:
    dotnet add package Excalibur.Dispatch
  • Install your chosen transport package (e.g., Excalibur.Dispatch.Transport.Kafka)
  • Familiarity with getting started and pipeline concepts

The Quick Decision​

If you are starting a new project and want a single recommendation:

  • Already on Azure? Use Azure Service Bus.
  • Already on AWS? Use AWS SQS.
  • Already on GCP? Use Google Pub/Sub.
  • Need partitioned event streaming? Use Kafka.
  • Need complex routing patterns (topic, header, fanout)? Use RabbitMQ.
  • Exploring locally? In-Memory can support local development. Moving to a broker requires verification of delivery, ordering, serialization and recovery assumptions; registration changes alone do not prove compatibility.

Transport Comparison​

Feature Matrix​

FeatureKafkaRabbitMQAzure Service BusAWS SQSGoogle Pub/Sub
Completed throughputMeasure selected workloadMeasure selected workloadMeasure selected workloadMeasure selected workloadMeasure selected workload
Message orderingPer-partitionPer-queuePer-sessionFIFO queuesPer-key
Message retentionConfigurable (days/weeks)Until consumedUntil consumedUp to 14 daysUntil consumed
Consumer groupsBuilt-inManual (competing consumers)SubscriptionsBuilt-inSubscriptions
Dead letter queueTopic-basedExchange-based (DLX)Native $DeadLetterQueue subqueueQueue-based (native redrive)Subscription-based
Replay/rewindYes (offset reset)NoNoNoYes (seek)
Managed cloud optionConfluent, MSK, etc.CloudAMQP, etc.Azure-nativeAWS-nativeGCP-native
Self-hostedYesYesNoNoNo
NativeAOTVerify selected configurationVerify selected configurationVerify selected configurationVerify selected configurationVerify selected configuration

When to Choose Each​

Kafka​

Best for partitioned event streaming and scenarios where you need to replay historical events.

Choose Kafka when:

  • Your measured streaming workload and deployment requirements suit its partitioned log model
  • You want to retain messages for days or weeks (log-style)
  • Multiple independent consumers need to read the same events at their own pace
  • You need replay capability (reprocess events from a point in time)
  • You are building event sourcing with event streaming as the backbone

Be aware:

  • Highest operational complexity (ZooKeeper/KRaft, partitions, replication)
  • Ordering is per-partition, not global (design partition keys carefully)
  • Schema Registry uses reflection (Activator.CreateInstance), which means AOT trimming requires [RequiresUnreferencedCode] annotations on Schema Registry paths
services.AddDispatch(dispatch =>
{
dispatch.UseKafka(kafka =>
{
kafka.BootstrapServers("broker1:9092,broker2:9092")
.ConfigureConsumer(c => c.GroupId("order-service"))
.MapTopic<OrderCreatedEvent>("orders.events");
});
});

RabbitMQ​

Best for traditional messaging with rich routing patterns.

Choose RabbitMQ when:

  • You need flexible routing: topic-based, header-based, fanout, or direct
  • You want a simple, well-understood message broker
  • You need request/reply (RPC) patterns
  • You prefer self-hosted infrastructure
  • Representative completed-throughput measurements satisfy your required volume

Be aware:

  • Messages are consumed and deleted (no replay)
  • Scaling consumers requires manual queue/exchange configuration
  • Clustering adds complexity for high availability
services.AddDispatch(dispatch =>
{
dispatch.UseRabbitMQ(rmq =>
{
rmq.ConnectionString("amqps://guest:guest@localhost:5671/")
.ConfigureExchange(ex => ex.Name("dispatch.events").Type(RabbitMQExchangeType.Topic));
});
});

Azure Service Bus​

Best for Azure-native applications that need enterprise messaging features.

Choose Azure Service Bus when:

  • Your application runs on Azure
  • You need session-based ordering (per-customer, per-order)
  • You want Azure-managed dead letter subqueues
  • You need scheduled message delivery
  • You want Azure AD (Entra ID) authentication instead of connection strings

Be aware:

  • Azure-only (no self-hosted option)
  • Pricing is per-operation (can be expensive at very high throughput)
  • Queue/topic limits depend on your Azure tier
services.AddDispatch(dispatch =>
{
dispatch.UseAzureServiceBus(asb =>
{
asb.ConnectionString(configuration.GetConnectionString("ServiceBus")!)
.ConfigureProcessor(p => p.DefaultEntityName = "orders-queue");
});
});

AWS SQS​

Best for AWS-native applications with simple queue semantics.

Choose AWS SQS when:

  • Your application runs on AWS
  • You want a fully managed, serverless queue (no infrastructure to manage)
  • You need native redrive policies for dead letter handling
  • You are using AWS Lambda as consumers
  • You want FIFO queues for strict ordering

Be aware:

  • AWS-only
  • Standard queues provide at-least-once delivery (not exactly-once)
  • FIFO quotas depend on partition, API action, throughput mode, batching and region; see the AWS message quota table.
  • AWS documents a maximum message size of 1 MiB. Evaluate Claim Check for larger payloads and verify the configured client/provider limits.
services.AddDispatch(dispatch =>
{
dispatch.UseAwsSqs(sqs =>
{
sqs.UseRegion("us-west-2")
.ConfigureQueue(q => q.VisibilityTimeout(TimeSpan.FromMinutes(5)))
.MapQueue<OrderCreated>("https://sqs.us-west-2.amazonaws.com/.../orders");
});
});

Google Pub/Sub​

Best for GCP-native applications with global messaging needs.

Choose Google Pub/Sub when:

  • Your application runs on GCP
  • You need global message delivery across regions
  • You want subscription-based fan-out (multiple subscribers per topic)
  • You need ordering keys for per-entity ordering
  • You want native dead letter topic support

Be aware:

  • GCP-only
  • Pricing is per-data-volume (can be cost-effective or expensive depending on message size)
  • Ordering is per-ordering-key, not global
services.AddDispatch(dispatch =>
{
dispatch.UseGooglePubSub(pubsub =>
{
pubsub.ProjectId("my-gcp-project")
.TopicId("dispatch-events")
.SubscriptionId("dispatch-events-sub");
});
});

Starting Simple​

You do not need to choose a production transport on day one. Dispatch's transport abstraction means your handlers, middleware, and routing logic are transport-independent.

Development: In-Memory​

Start with the built-in in-memory transport. No broker to install, no configuration to manage:

services.AddDispatch(dispatch =>
{
dispatch.AddHandlersFromAssembly(typeof(Program).Assembly);
// In-memory transport is the default — no UseXxx() call needed
});

First Deployment: Single Transport​

When you are ready for a real broker, add one transport:

services.AddDispatch(dispatch =>
{
dispatch.AddHandlersFromAssembly(typeof(Program).Assembly);
dispatch.UseRabbitMQ(rmq => rmq.ConnectionString(connectionString));
});

Handlers may be reusable, but verify their delivery, ordering, serialization and recovery assumptions when changing transport. Registration changes alone do not establish behavioral compatibility.

Growing System: Multi-Transport​

As your system grows, you may find that different message types have different needs. Route them to different transports:

services.AddDispatch(dispatch =>
{
dispatch.AddHandlersFromAssembly(typeof(Program).Assembly);

// Events requiring a partitioned log to Kafka
dispatch.UseKafka(kafka => kafka.BootstrapServers("kafka:9092"));

// Command processing to RabbitMQ
dispatch.UseRabbitMQ(rmq => rmq.ConnectionString(rmqConnectionString));

dispatch.UseRouting(routing =>
{
routing.Transport
.Route<OrderCreatedEvent>().To("kafka")
.Route<PaymentProcessedEvent>().To("kafka")
.Route<SendNotificationCommand>().To("rabbitmq")
.Default("rabbitmq");
});
});

Reference: Message Routing for the full routing API.

Serialization Considerations​

Transport serialization requires supported contracts and metadata for the selected types. For NativeAOT, provide the required generated serialization contracts. Compare actual payloads before selecting JSON or a binary format:

ScenarioRecommended Serializer
General purposeSystem.Text.Json (default)
.NET-only binary candidateMemoryPack (opt-in; measure the workload)
Mixed language consumersSystem.Text.Json or Protobuf
Binary size candidateMessagePack (measure serialized payloads)
Schema evolution neededProtobuf
// Evaluate MemoryPack for the selected .NET-only payloads
services.AddMemoryPackSerializer();

// Or MessagePack for compact binary
services.AddMessagePackSerializer();

Resilience Across Transports​

Every transport supports the same resilience features, but each has transport-specific tuning:

ConcernHow It Works
Connection recoveryAll transports auto-reconnect on network failures
Circuit breakersPer-transport isolation via ITransportCircuitBreakerRegistry
Dead letter handlingApplication-level (IDeadLetterQueue) works with any transport. All 5 production transports implement IDeadLetterQueueManager for transport-native DLQ
Health checksservices.AddHealthChecks().AddTransportHealthChecks() monitors all registered transports

Reference: Error Handling & Recovery Guide for the full resilience story.

Summary​

Decision FactorKafkaRabbitMQAzure SBAWS SQSGoogle Pub/Sub
Start here if...You need event streamingYou need routing flexibilityYou're on AzureYou're on AWSYou're on GCP
Earlier unverified throughput illustrationsMillions/secTens of thousands/secHundreds of thousands/secThousands/sec (FIFO)Hundreds of thousands/sec
Operational burdenHigh (self-managed)MediumLow (managed)Low (managed)Low (managed)
Replay capabilityYesNoNoNoYes (seek)
Self-hostedYesYesNoNoNo

These earlier throughput illustrations are not provider limits or framework benchmark results. Measure the actual configuration, payload and durability requirements.

Dispatch's abstractions can reduce migration work. Switching transports still requires verification of ordering, delivery, serialization and recovery assumptions in handlers, middleware and business logic.

Next Steps​

See Also​

  • In-Memory Transport — Built-in transport for development and testing without a broker
  • Message Mapping — Configure how message types map to transport-specific destinations
  • Health Checks — Monitor transport connectivity and health