/// <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 Classification(ClassificationAttribute attribute, IEventStreamSettings settings = null) { _domainName = attribute.DomainName; _entityTypeName = attribute.EntityTypeName; _instanceKey = attribute.InstanceKey; _classifierTypeName = attribute.ClassifierTypeName; if (null == settings) { _settings = new EventStreamSettings(); } else { _settings = settings; } _connectionStringName = _settings.GetConnectionStringName(attribute); if (null == _classificationProcessor) { _classificationProcessor = _settings.CreateClassificationProcessorForEventStream(attribute); } }
/// <summary> /// Create any static classes used to dispatch notifications /// </summary> /// <param name="services"></param> public static void CreateDispatchers(IServiceCollection services) { if (null != services) { INameResolver nameResolver = null; IOptions <EventSourcingOnAzureOptions> options = null; ILogger logger = null; IEventStreamSettings settings = null; var provider = services.BuildServiceProvider(); using (var scope = provider.CreateScope()) { nameResolver = scope.ServiceProvider.GetRequiredService <INameResolver>(); IConfiguration configuration = scope.ServiceProvider.GetRequiredService <IConfiguration> (); if (null != configuration) { EventSourcingOnAzureOptions optionConfig = new EventSourcingOnAzureOptions(configuration); options = Options.Create <EventSourcingOnAzureOptions>(optionConfig); if (null == nameResolver) { // make a default name resolver nameResolver = new NotificationDispatcherNameResolver(configuration); } } // Get the event stream settings to use settings = scope.ServiceProvider.GetRequiredService <IEventStreamSettings>(); } if (null == options) { // make a default set of options } // Add the default notification dispatchers if (NotificationDispatchers == null) { NotificationDispatchers = new ConcurrentDictionary <string, INotificationDispatcher>(); } EventGridNotificationDispatcher evDispatcher = new EventGridNotificationDispatcher(options, nameResolver, logger); if (evDispatcher != null) { NotificationDispatchers.TryAdd(evDispatcher.Name, evDispatcher); } QueueNotificationDispatcher quDispatch = new QueueNotificationDispatcher(options, settings, logger); if (quDispatch != null) { NotificationDispatchers.TryAdd(quDispatch.Name, quDispatch); } NullNotificationDispatcher nuDispatch = new NullNotificationDispatcher(); if (nuDispatch != null) { NotificationDispatchers.TryAdd(nuDispatch.Name, nuDispatch); } } }
public EventStream(EventStreamAttribute attribute, IWriteContext context = null, IEventStreamSettings settings = null, INotificationDispatcher dispatcher = null ) { _domainName = attribute.DomainName; _entityTypeName = attribute.EntityTypeName; _instanceKey = attribute.InstanceKey; if (null == settings) { _settings = new EventStreamSettings(); } else { _settings = settings; } // wire up the event stream writer _writer = _settings.CreateWriterForEventStream(attribute); if (null != context) { _context = context; if (null != _writer) { _writer.SetContext(_context); } } if (null == dispatcher) { if (!string.IsNullOrWhiteSpace(attribute.NotificationDispatcherName)) { _notificationDispatcher = NotificationDispatcherFactory.GetDispatcher(attribute.NotificationDispatcherName); } else { // Create a new dispatcher _notificationDispatcher = NotificationDispatcherFactory.GetDefaultDispatcher(); } } else { _notificationDispatcher = dispatcher; } }
/// <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 Classification(ClassificationAttribute attribute, IEventStreamSettings settings = null, INotificationDispatcher dispatcher = null, IClassificationSnapshotReader snapshotReader = null, IClassificationSnapshotWriter snapshotWriter = null) { _domainName = attribute.DomainName; _entityTypeName = attribute.EntityTypeName; _instanceKey = attribute.InstanceKey; _classifierTypeName = attribute.ClassifierTypeName; if (null == settings) { _settings = new EventStreamSettings(); } else { _settings = settings; } _connectionStringName = _settings.GetConnectionStringName(attribute); if (null == _classificationProcessor) { _classificationProcessor = _settings.CreateClassificationProcessorForEventStream(attribute); } if (null == dispatcher) { // Create a new dispatcher _notificationDispatcher = NotificationDispatcherFactory.NotificationDispatcher; } else { _notificationDispatcher = dispatcher; } if (null != snapshotReader) { _snapshotReader = snapshotReader; } if (null != snapshotWriter) { _snapshotWriter = snapshotWriter; } }
public QueueNotificationDispatcher(IOptions <EventSourcingOnAzureOptions> options, IEventStreamSettings settings, ILogger logger) { if (options == null) { throw new ArgumentNullException(nameof(options)); } _options = options; if (settings == null) { throw new ArgumentNullException(nameof(settings)); } _eventStreamSettings = settings; if (null != logger) { _logger = logger; } }
/// <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) { _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; } }
/// <summary> /// Create a new binding for the projection /// </summary> /// <param name="parameter"> /// Details of the attribute and parameter to be bound to /// </param> public ClassificationAttributeBinding(ParameterInfo parameter, IEventStreamSettings eventStreamSettings) { _parameter = parameter; _eventStreamSettings = eventStreamSettings; }
public ProjectionAttributeBindingProvider(IEventStreamSettings eventStreamSettings) { _eventStreamSettings = eventStreamSettings; }
/// <summary> /// Create a new binding for the projection /// </summary> /// <param name="parameter"> /// Details of the attribute and parameter to be bound to /// </param> public ProjectionAttributeBinding(ParameterInfo parameter, IEventStreamSettings eventStreamSettings) { _parameter = parameter; _eventStreamSettings = eventStreamSettings; }
public ClassificationValueBinder(ParameterInfo parameter, IEventStreamSettings eventStreamSettings) { _parameter = parameter; _eventStreamSettings = eventStreamSettings; }
public ProjectionValueBinder(ParameterInfo parameter, IEventStreamSettings eventStreamSettings) { _parameter = parameter; _eventStreamSettings = eventStreamSettings; }
public EventStreamAttributeBindingProvider(IEventStreamSettings eventStreamSettings) { _eventStreamSettings = eventStreamSettings; }