Skip to content

Producers

Producers, along with Subscriptions, are the foundation of the Eventuous’ messaging system.

Although an event store produces events too, it is normally used via the Aggregate store. Sometimes, you just need to produce arbitrary messages, which aren’t necessarily events. For example, you can also produce commands. Still, the main purpose of a producer is to put events to an event database or a broker, so they can be consumed by a subscription.

Within Eventuous, the main purpose of producers is to support gateways, and, through gateways, enable creation of connectors.

Producers support sending messages to multiple streams in parallel using a collection of ProduceRequest:

var requests = new ProduceRequest[] {
new(stream1, messages1),
new(stream2, messages2)
};
await producer.Produce(requests, cancellationToken);

The default implementation fans out to individual Produce calls using Task.WhenAll. Custom producer implementations can override this for more efficient batching.