Skip to main content

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):
PropertyDescription
PartitionKeyWhen 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:
PropertyDefaultDescription
TypefanoutExchange type (fanout, direct, topic)
DurabletrueSurvives broker restart
AutoDeletefalseDeleted when no consumers remain
RabbitMqProduceOptions (per-produce):
PropertyDescription
RoutingKeyWorks with direct and topic exchanges
PersistedWhether messages are durable (default true)
PriorityMessage priority 0–9
ExpirationTTL in milliseconds
AppIdApplication identifier visible in the management UI
ReplyToOptional 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:
PropertyDefaultDescription
ExchangeExchange to bind to (required)
ExchangeOptionsfanoutControls exchange declaration
QueueOptions.Queuesubscription IDQueue name (defaults to SubscriptionId)
ConcurrencyLimit1Number of concurrent message handlers
PrefetchCountConcurrencyLimit × 2RabbitMQ 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):
PropertyDescription
OrderingKeyEnables message ordering (publisher must be configured to support it)
AddAttributesAdds 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:
PropertyDescription
QueueOrTopicA Queue("name"), Topic("name"), or TopicAndSubscription("topic", "sub") record
ProcessorOptionsStandard ServiceBusProcessorOptions (prefetch, lock renewal, etc.)
SessionProcessorOptionsWhen set, enables session-aware processing
ErrorHandlerOptional custom error handler delegate

Build docs developers (and LLMs) love