public static void Attach(IDatabaseSystem system, ILogger logger, IEventTransformer transformer) { if (system == null) { throw new ArgumentNullException(nameof(system)); } if (!(system is IEventHandler)) { throw new ArgumentException("The database system is not handling events"); } ((IEventHandler)system).Consume(@event => { try { var entry = transformer?.Transform(@event); if (entry == null) { throw new LogException("It was not possible to generate a log entry from an event"); } if (logger.IsInterestedIn(entry.Level)) { logger.LogAsync(entry).ConfigureAwait(false).GetAwaiter().GetResult(); } } catch (LogException) { throw; } catch (Exception ex) { throw new LogException("An error occurred while logging an event", ex); } }); }
public EventSubscriber(IEventStoreConnection connection, UserCredentials creds, string streamName, IEventTransformer transformer) { this.connection = connection; this.creds = creds; StreamName = streamName; this.transformer = transformer; }
public BatchReader(IEventStoreConnection connection, IEventTransformer transformer, int batchSize) { this.connection = connection; this.batchSize = batchSize; eventTransformer = transformer; }
public EventStoreReader(IEventStoreConnection connection, IEventTransformer transformer) { this.connection = connection; eventTransformer = transformer; batchReader = new BatchReader(connection, transformer, 10); }
public EventStoreWriter(IEventStoreConnection connection, IEventTransformer transformer) { this.connection = connection; this.transformer = transformer; }
protected BatchReader GivenSut(IEventStoreConnection connection, IEventTransformer transformer) { return(new BatchReader(connection, transformer, batchSize)); }