/// <summary> /// Create the projection from the attribute linked to the function parameter /// </summary> /// <param name="attribute"> /// The attribute describing which projection to run /// </param> public Projection(ProjectionAttribute attribute, IEventStreamSettings settings = null, INotificationDispatcher dispatcher = null, IProjectionSnapshotReader snapshotReader = null, IProjectionSnapshotWriter snapshotWriter = null) { _domainName = attribute.DomainName; _entityTypeName = attribute.EntityTypeName; _instanceKey = attribute.InstanceKey; _projectionTypeName = attribute.ProjectionTypeName; if (null == settings) { _settings = new EventStreamSettings(); } else { _settings = settings; } _connectionStringName = _settings.GetConnectionStringName(attribute); if (null == _projectionProcessor) { _projectionProcessor = _settings.CreateProjectionProcessorForEventStream(attribute); } if (null == dispatcher) { // Create a new dispatcher _notificationDispatcher = NotificationDispatcherFactory.NotificationDispatcher; } else { _notificationDispatcher = dispatcher; } if (null != snapshotReader) { _snapshotReader = snapshotReader; } if (null != snapshotWriter) { _snapshortWriter = snapshotWriter; } }
public ProjectionJob( IEventStoreClient client, IDependencyInitializer initializer, IProjectionOptionsFactory optionsFactory, IProjectionProcessor <TProjection> processor) { this.jobDependencies = initializer; this.processor = processor; var options = optionsFactory.GetOptions <TProjection>(); subscription = client.SubscribeToStreams( ConsumerGroup.GetAsAutoScalingInstance(options.Name), SubscriptionStartOptions.FromBegining, OnProcessEventsAsync); }