Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Eventuous/eventuous/llms.txt
Use this file to discover all available pages before exploring further.
Eventuous provides first-class integration packages for the most popular message brokers, allowing you to publish domain events to external systems and consume messages from them inside subscriptions. All broker integrations share the same IProducer / IProducer<TProduceOptions> abstractions and the standard AddSubscription registration pattern.
Producer abstraction
All producers implement one of:
IProducer — produce without per-call options
IProducer<TProduceOptions> — produce with per-message or per-batch options (e.g. routing key, partition key)
Producers that need lifecycle management (connection setup, graceful flush) additionally implement IHostedProducer, which wires into .NET’s IHostedService machinery automatically when registered through the Gateway helpers.
Kafka
Package: Eventuous.Kafka
dotnet add package Eventuous.Kafka
Producer — KafkaBasicProducer
Serialises events to byte[] and publishes them to a Kafka topic. The event type name is stored in a Kafka message header (message-type) so consumers can deserialise without a schema registry.
var producer = new KafkaBasicProducer(
new KafkaProducerOptions(
new ProducerConfig {
BootstrapServers = "localhost:9092"
}
)
);
KafkaProduceOptions (per-produce):
| Property | Description |
|---|
PartitionKey | When set, messages are produced with a string key and routed to a consistent partition |
Subscription — KafkaBasicSubscription
KafkaBasicSubscription is not yet implemented. The Subscribe and Unsubscribe methods throw NotImplementedException. Do not use it in production.
KafkaBasicSubscription is the planned subscription class for consuming from a Kafka topic. It is registered via KafkaSubscriptionOptions:
services.AddSubscription<KafkaBasicSubscription, KafkaSubscriptionOptions>(
"PaymentsKafka",
builder => builder
.Configure(x => {
x.ConsumerConfig = new ConsumerConfig {
BootstrapServers = "localhost:9092",
GroupId = "payments-consumer-group",
AutoOffsetReset = AutoOffsetReset.Earliest
};
})
.AddEventHandler<PaymentHandler>()
);
RabbitMQ
Package: Eventuous.RabbitMq
dotnet add package Eventuous.RabbitMq
Producer — RabbitMqProducer
Publishes events to a RabbitMQ exchange. The exchange is declared automatically on first publish. The producer uses publisher confirms to guarantee delivery.
var producer = new RabbitMqProducer(
connectionFactory: new ConnectionFactory {
HostName = "localhost"
},
options: new RabbitMqExchangeOptions {
Type = ExchangeType.Fanout,
Durable = true,
AutoDelete = false
}
);
RabbitMqExchangeOptions controls how the exchange is declared:
| Property | Default | Description |
|---|
Type | fanout | Exchange type (fanout, direct, topic) |
Durable | true | Survives broker restart |
AutoDelete | false | Deleted when no consumers remain |
RabbitMqProduceOptions (per-produce):
| Property | Description |
|---|
RoutingKey | Works with direct and topic exchanges |
Persisted | Whether messages are durable (default true) |
Priority | Message priority 0–9 |
Expiration | TTL in milliseconds |
AppId | Application identifier visible in the management UI |
ReplyTo | Optional reply address for request-reply patterns |
Subscription — RabbitMqSubscription
Consumes from a RabbitMQ exchange by declaring a queue and binding it to the exchange. Queue and binding options are configurable.
services.AddSubscription<RabbitMqSubscription, RabbitMqSubscriptionOptions>(
"BookingEvents",
builder => builder
.Configure(x => {
x.Exchange = "bookings";
x.ExchangeOptions = new RabbitMqExchangeOptions { Type = ExchangeType.Fanout };
x.ConcurrencyLimit = 4;
})
.AddEventHandler<BookingEventHandler>()
);
RabbitMqSubscriptionOptions key properties:
| Property | Default | Description |
|---|
Exchange | — | Exchange to bind to (required) |
ExchangeOptions | fanout | Controls exchange declaration |
QueueOptions.Queue | subscription ID | Queue name (defaults to SubscriptionId) |
ConcurrencyLimit | 1 | Number of concurrent message handlers |
PrefetchCount | ConcurrencyLimit × 2 | RabbitMQ prefetch count |
Google Cloud Pub/Sub
Package: Eventuous.GooglePubSub
dotnet add package Eventuous.GooglePubSub
Producer — GooglePubSubProducer
Publishes events to a GCP Pub/Sub topic. Topics are created automatically when the producer first publishes to them (if the service account has the necessary permissions).
var producer = new GooglePubSubProducer(
projectId: "my-gcp-project"
);
// Or via options for full control:
var producer = new GooglePubSubProducer(
new PubSubProducerOptions {
ProjectId = "my-gcp-project",
ConfigureClientBuilder = builder => { /* configure emulator, etc. */ }
}
);
PubSubProduceOptions (per-produce):
| Property | Description |
|---|
OrderingKey | Enables message ordering (publisher must be configured to support it) |
AddAttributes | Adds custom key/value attributes to the Pub/Sub message |
Subscription — GooglePubSubSubscription
Consumes from a GCP Pub/Sub subscription. The subscription can be created automatically via CreateSubscription = true in the options.
services.AddSubscription<GooglePubSubSubscription, PubSubSubscriptionOptions>(
"BookingsPubSub",
builder => builder
.Configure(x => {
x.ProjectId = "my-gcp-project";
x.TopicId = "bookings";
x.CreateSubscription = true;
})
.AddEventHandler<BookingPubSubHandler>()
);
Cloud Run variant
For push-based Pub/Sub on Google Cloud Run, use the companion package:
dotnet add package Eventuous.GooglePubSub.CloudRun
CloudRunPubSubSubscription exposes an HTTP POST endpoint that the Pub/Sub push trigger calls. Map the endpoint after building the application:
var app = builder.Build();
app.MapCloudRunPubSubSubscription(); // maps POST "/" by default
app.Run();
Azure Service Bus
Package: Eventuous.Azure.ServiceBus
dotnet add package Eventuous.Azure.ServiceBus
Producer — ServiceBusProducer
Sends events to an Azure Service Bus queue or topic. Single-message sends and batched sends are both handled automatically based on the number of messages in a produce call.
var client = new ServiceBusClient(connectionString);
var producer = new ServiceBusProducer(
client,
new ServiceBusProducerOptions {
QueueOrTopicName = "bookings"
}
);
Subscription — ServiceBusSubscription
Processes messages from a Service Bus queue or topic subscription. Both standard processing and session-enabled processing are supported.
services.AddSubscription<ServiceBusSubscription, ServiceBusSubscriptionOptions>(
"BookingsServiceBus",
builder => builder
.Configure(x => {
x.QueueOrTopic = new Queue("bookings");
})
.AddEventHandler<BookingServiceBusHandler>()
);
ServiceBusSubscriptionOptions key properties:
| Property | Description |
|---|
QueueOrTopic | A Queue("name"), Topic("name"), or TopicAndSubscription("topic", "sub") record |
ProcessorOptions | Standard ServiceBusProcessorOptions (prefetch, lock renewal, etc.) |
SessionProcessorOptions | When set, enables session-aware processing |
ErrorHandler | Optional custom error handler delegate |