Class EventSeeding
- Namespace
- Cratis.Chronicle.Seeding
- Assembly
- Cratis.Chronicle.dll
Represents an implementation of IEventSeeding.
public class EventSeeding : IEventSeeding, IEventSeedingBuilder
- Inheritance
-
EventSeeding
- Implements
- Inherited Members
- Extension Methods
Remarks
Initializes a new instance of the EventSeeding class.
Constructors
EventSeeding(EventStoreName, IChronicleConnection, IEventTypes, IEventSerializer, IClientArtifactsProvider, IServiceProvider, IClientArtifactsActivator, ILogger<EventSeeding>)
Represents an implementation of IEventSeeding.
public EventSeeding(EventStoreName eventStoreName, IChronicleConnection connection, IEventTypes eventTypes, IEventSerializer eventSerializer, IClientArtifactsProvider clientArtifactsProvider, IServiceProvider serviceProvider, IClientArtifactsActivator artifactActivator, ILogger<EventSeeding> logger)
Parameters
eventStoreNameEventStoreNameThe event store name.
connectionIChronicleConnectionThe Chronicle connection.
eventTypesIEventTypesThe event types.
eventSerializerIEventSerializerThe event serializer.
clientArtifactsProviderIClientArtifactsProviderThe client artifacts provider.
serviceProviderIServiceProviderThe service provider.
artifactActivatorIClientArtifactsActivatorThe artifact activator.
loggerILogger<EventSeeding>The logger.
Remarks
Initializes a new instance of the EventSeeding class.
EventSeeding(EventStoreName, IChronicleConnection, IEventTypes, IEventSerializer, IClientArtifactsProvider, IServiceProvider, IClientArtifactsActivator, ILogger<EventSeeding>, IEventSources?)
Initializes a new instance of the EventSeeding class with typed routing support.
public EventSeeding(EventStoreName eventStoreName, IChronicleConnection connection, IEventTypes eventTypes, IEventSerializer eventSerializer, IClientArtifactsProvider clientArtifactsProvider, IServiceProvider serviceProvider, IClientArtifactsActivator artifactActivator, ILogger<EventSeeding> logger, IEventSources? eventSources)
Parameters
eventStoreNameEventStoreNameThe event store name.
connectionIChronicleConnectionThe Chronicle connection.
eventTypesIEventTypesThe event types.
eventSerializerIEventSerializerThe event serializer.
clientArtifactsProviderIClientArtifactsProviderThe client artifacts provider.
serviceProviderIServiceProviderThe service provider.
artifactActivatorIClientArtifactsActivatorThe artifact activator.
loggerILogger<EventSeeding>The logger.
eventSourcesIEventSourcesThe event source definitions.
Methods
Discover()
Discovers all registered event seeders.
public Task Discover()
Returns
- Task
Awaitable task.
ForEventSource(EventSourceId, EventStreamType, EventStreamId, IEnumerable<object>, EventSourceType?)
Seeds events onto an event stream.
public IEventSeedingBuilder ForEventSource(EventSourceId eventSourceId, EventStreamType eventStreamType, EventStreamId eventStreamId, IEnumerable<object> events, EventSourceType? eventSourceType = null)
Parameters
eventSourceIdEventSourceIdThe event source identifier.
eventStreamTypeEventStreamTypeThe stream type.
eventStreamIdEventStreamIdThe stream identifier.
eventsIEnumerable<object>The events to seed.
eventSourceTypeEventSourceTypeThe optional source type.
Returns
- IEventSeedingBuilder
The builder for continuation.
Exceptions
- EventSeedingRoutingNotSupported
The implementation does not support routing.
ForEventSource(EventSourceId, IEnumerable<object>)
Seed events for a specific event source id with multiple event types. By default, seed data applies to all namespaces globally.
public IEventSeedingBuilder ForEventSource(EventSourceId eventSourceId, IEnumerable<object> events)
Parameters
eventSourceIdEventSourceIdThe event source id to seed for.
eventsIEnumerable<object>Collection of events to seed.
Returns
- IEventSeedingBuilder
The builder for continuation.
ForEvents(IEnumerable<EventForEventSourceId>)
Seeds individually routed events, merging their tags with event-type tags.
public IEventSeedingBuilder ForEvents(IEnumerable<EventForEventSourceId> events)
Parameters
eventsIEnumerable<EventForEventSourceId>The routed events.
Returns
- IEventSeedingBuilder
The builder for continuation.
Exceptions
- EventSeedingRoutingNotSupported
The implementation does not support routing.
ForNamespace(EventStoreNamespaceName)
Configure seed data to be specific to a namespace.
public IEventSeedingScopeBuilder ForNamespace(EventStoreNamespaceName @namespace)
Parameters
namespaceEventStoreNamespaceNameThe namespace to seed for.
Returns
- IEventSeedingScopeBuilder
A scoped builder for namespace-specific seed data.
For<TEvent>(EventSourceId, EventStreamType, EventStreamId, IEnumerable<TEvent>, EventSourceType?)
Seeds events of one type onto an event stream.
public IEventSeedingBuilder For<TEvent>(EventSourceId eventSourceId, EventStreamType eventStreamType, EventStreamId eventStreamId, IEnumerable<TEvent> events, EventSourceType? eventSourceType = null) where TEvent : class
Parameters
eventSourceIdEventSourceIdThe event source identifier.
eventStreamTypeEventStreamTypeThe stream type.
eventStreamIdEventStreamIdThe stream identifier.
eventsIEnumerable<TEvent>The events to seed.
eventSourceTypeEventSourceTypeThe optional source type.
Returns
- IEventSeedingBuilder
The builder for continuation.
Type Parameters
TEventThe event type.
Exceptions
- EventSeedingRoutingNotSupported
The implementation does not support routing.
For<TEvent>(EventSourceId, IEnumerable<TEvent>)
Seed events for a specific event type and event source id. By default, seed data applies to all namespaces globally.
public IEventSeedingBuilder For<TEvent>(EventSourceId eventSourceId, IEnumerable<TEvent> events) where TEvent : class
Parameters
eventSourceIdEventSourceIdThe event source id to seed for.
eventsIEnumerable<TEvent>Collection of events to seed.
Returns
- IEventSeedingBuilder
The builder for continuation.
Type Parameters
TEventType of event to seed.
Register()
Registers all discovered event seeders by invoking them and sending seed data to the server.
public Task Register()
Returns
- Task
Awaitable task.
Exceptions
- EventSeedingRoutingNotSupported
Thrown before sending entries when routing support is not confirmed by the kernel.