public SqlEventPersistance(IEventSerializer serializer, string connectionString)
 {
     Contract.Requires<ArgumentNullException>(serializer != null, "serializer cannot be null");
     Contract.Requires<ArgumentException>(!String.IsNullOrWhiteSpace(connectionString), "connectionString cannot be null, empty or whitespace");
     _serializer = serializer;
     _connectionString = connectionString;
 }
        public override void SetUp()
        {
            base.SetUp();

            DatabaseHelper.CleanEvents();
            DatabaseHelper.CleanEventStreams();

            var eventRepository = new EventRepository(DatabaseHelper.GetConnectionStringBuilder());

            EventSerializer = new Serialization.Newtonsoft.EventSerializer();

            var logger = new SerilogLogger(Log.ForContext<EventStore>());

            var eventStore = new EventStore(
                EventSerializer,
                eventRepository,
                logger,
                Guid.NewGuid);

            AggregateContext = new AggregateContext(
                eventStore,
                null, // TODO: replace with actual SnapshotStore
                new AggregateHydrator(),
                new DummyDispatcher());
        }
Example #3
0
 public void SetUp() {
   serializer_ = EventSerializers.FuncToEventSerializer(
     @event =>
       new EventData(Guid.Empty, typeof (Created).FullName, false,
         new byte[0], new byte[0]),
     data => (Event) Activator.CreateInstance(Type.GetType(data.Type)));
 }
		/// <summary>
		/// Add events to an existing appender, events in order will be serialized as a single bytestream.
		/// </summary>
		/// <param name="dest">appender</param>
		/// <param name="source">events to add</param>
		/// <paramref name="serializer">serializer, default binary</paramref>
		public static void AddEvents(this IAppendOnlyStore dest, IEnumerable<IEvent> source, IEventSerializer serializer = null)
		{
			if (dest == null)
			{
				throw new ArgumentNullException("dest");
			}
			if (source == null)
			{
				throw new ArgumentNullException("source");
			}

			var es = new EventStore.EventStore(dest, serializer ?? new BinaryFormatterSerializer());

			var events = source as IEvent[] ?? source.ToArray();

			var versions = new Dictionary<IIdentity, int>();

			List<IEvent> stack = new List<IEvent>();


			Action savestack = () =>
			{
				if (!versions.ContainsKey(stack[0].AggregateId))
				{
					versions[stack[0].AggregateId] = 0;
				}

				es.AppendToStream(stack[0].AggregateId, versions[stack[0].AggregateId], stack);
				versions[stack[0].AggregateId]++;
				stack.Clear();
			};

			if (events.Any())
			{
				IIdentity lastid = null;

				foreach (var e in events)
				{
					if (stack.Any() && !lastid.Equals(e.AggregateId))
					{
						savestack();
					}
					//else
					{
						stack.Add(e);
						lastid = e.AggregateId;
					}
				}
			}

			savestack();
		}
Example #5
0
 public DomainEventConsumer(string groupName = null, ConsumerSetting setting = null, bool sendEventHandledMessage = true)
 {
     _consumer = new Consumer(groupName ?? DefaultEventConsumerGroup, setting ?? new ConsumerSetting
     {
         MessageHandleMode = MessageHandleMode.Sequential
     });
     _sendReplyService = new SendReplyService();
     _jsonSerializer = ObjectContainer.Resolve<IJsonSerializer>();
     _eventSerializer = ObjectContainer.Resolve<IEventSerializer>();
     _processor = ObjectContainer.Resolve<IMessageProcessor<ProcessingDomainEventStreamMessage, DomainEventStreamMessage, bool>>();
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
     _sendEventHandledMessage = sendEventHandledMessage;
 }
Example #6
0
    public void SaveEvents(Guid aggregate_id, ICollection<Event> events,
      int expected_version, IEventSerializer serializer) {
      string stream_name = StreamNameForID(aggregate_id);
      if (events.Count < kWritePageSize) {
        SaveEventsAtOnce(stream_name, expected_version, events, serializer);
      } else {
        SaveEventsInBatch(stream_name, expected_version, events, serializer);
      }

      foreach (Event @event in events) {
        publisher_.Publish(@event);
      }
    }
        public MongoEventStore(
            IMongoCollection<BsonDocument> commitCollection,
            IMongoCollection<BsonDocument> eventCollection,
            IEventSerializer eventBsonSerializer)
        {
            if (commitCollection == null) throw new ArgumentNullException(nameof(commitCollection));
            if (eventCollection == null) throw new ArgumentNullException(nameof(eventCollection));
            if (eventBsonSerializer == null) throw new ArgumentNullException(nameof(eventBsonSerializer));

            _commitSerializer = new CommitSerializer();
            _eventContainerSerializer = new EventContainerSerializer(eventBsonSerializer);

            _commitDao = new CommitDao(commitCollection);
            _eventDao = new EventDao(eventCollection);
        }
Example #8
0
 public IList<Event> GetEventsForAggregateSince(Guid aggregate_id,
   IEventSerializer serializer, int version) {
   var events = new List<Event>();
   var stream_name = StreamNameForID(aggregate_id);
   int position = version;
   StreamEventsSlice slice;
   do {
     slice = connection_.ReadStreamEventsForward(stream_name, position,
       kReadPageSize, false);
     position = slice.NextEventNumber;
     var serialized_events =
       slice.Events.Select(@event => Deserialize(@event, serializer));
     events.AddRange(serialized_events);
   } while (!slice.IsEndOfStream);
   return events;
 }
        /// <summary>Parameterized constructor.
        /// </summary>
        public SqlServerCommandStore()
        {
            var setting = ENodeConfiguration.Instance.Setting.SqlServerCommandStoreSetting;
            Ensure.NotNull(setting, "SqlServerCommandStoreSetting");
            Ensure.NotNull(setting.ConnectionString, "SqlServerCommandStoreSetting.ConnectionString");
            Ensure.NotNull(setting.TableName, "SqlServerCommandStoreSetting.TableName");
            Ensure.NotNull(setting.PrimaryKeyName, "SqlServerCommandStoreSetting.PrimaryKeyName");

            _connectionString = setting.ConnectionString;
            _commandTable = setting.TableName;
            _primaryKeyName = setting.PrimaryKeyName;
            _jsonSerializer = ObjectContainer.Resolve<IJsonSerializer>();
            _typeCodeProvider = ObjectContainer.Resolve<ITypeCodeProvider>();
            _eventSerializer = ObjectContainer.Resolve<IEventSerializer>();
            _ioHelper = ObjectContainer.Resolve<IOHelper>();
            _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
        }
        public async Task<IEventStore> CreateAsync(string connectionString, string databaseName,
            IEventSerializer eventSerializer = null)
        {
            if (connectionString == null) throw new ArgumentNullException(nameof(connectionString));
            if (databaseName == null) throw new ArgumentNullException(nameof(databaseName));

            var mongoClient = new MongoClient(connectionString);
            var database = mongoClient.GetDatabase(databaseName);

            var eventCollection = GetEventCollection(database);
            var commitCollection = GetCommitCollection(database);

            var mongoEventStore = new MongoEventStore(commitCollection, eventCollection,
                eventSerializer ?? CreateDefaultEventBsonDocumentSerializer());

            var indexCreator = new IndexCreator(commitCollection);
            await indexCreator.EnsureIndexesAsync();

            return mongoEventStore;
        }
        public SqlServerEventStore()
        {
            var configSetting = ENodeConfiguration.Instance.Setting;
            var setting = configSetting.SqlServerEventStoreSetting;
            Ensure.NotNull(setting, "SqlServerEventStoreSetting");
            Ensure.NotNull(setting.ConnectionString, "SqlServerEventStoreSetting.ConnectionString");
            Ensure.NotNull(setting.TableName, "SqlServerEventStoreSetting.TableName");
            Ensure.NotNull(setting.PrimaryKeyName, "SqlServerEventStoreSetting.PrimaryKeyName");
            Ensure.Positive(configSetting.SqlServerBulkCopyBatchSize, "SqlServerBulkCopyBatchSize");
            Ensure.Positive(configSetting.SqlServerBulkCopyTimeout, "SqlServerBulkCopyTimeout");

            _connectionString = setting.ConnectionString;
            _eventTable = setting.TableName;
            _primaryKeyName = setting.PrimaryKeyName;
            _bulkCopyBatchSize = configSetting.SqlServerBulkCopyBatchSize;
            _bulkCopyTimeout = configSetting.SqlServerBulkCopyTimeout;
            _jsonSerializer = ObjectContainer.Resolve<IJsonSerializer>();
            _eventSerializer = ObjectContainer.Resolve<IEventSerializer>();
            _ioHelper = ObjectContainer.Resolve<IOHelper>();
            _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
        }
Example #12
0
        public SqlServerEventStore(OptionSetting optionSetting)
        {
            if (optionSetting != null)
            {
                _connectionString = optionSetting.GetOptionValue<string>("ConnectionString");
                _tableName = optionSetting.GetOptionValue<string>("TableName");
                _tableCount = optionSetting.GetOptionValue<int>("TableCount");
                _versionIndexName = optionSetting.GetOptionValue<string>("VersionIndexName");
                _commandIndexName = optionSetting.GetOptionValue<string>("CommandIndexName");
                _bulkCopyBatchSize = optionSetting.GetOptionValue<int>("BulkCopyBatchSize");
                _bulkCopyTimeout = optionSetting.GetOptionValue<int>("BulkCopyTimeout");
            }
            else
            {
                var setting = ENodeConfiguration.Instance.Setting.DefaultDBConfigurationSetting;
                _connectionString = setting.ConnectionString;
                _tableName = setting.EventTableName;
                _tableCount = setting.EventTableCount;
                _versionIndexName = setting.EventTableVersionUniqueIndexName;
                _commandIndexName = setting.EventTableCommandIdUniqueIndexName;
                _bulkCopyBatchSize = setting.EventTableBulkCopyBatchSize;
                _bulkCopyTimeout = setting.EventTableBulkCopyTimeout;
            }

            Ensure.NotNull(_connectionString, "_connectionString");
            Ensure.NotNull(_tableName, "_tableName");
            Ensure.NotNull(_versionIndexName, "_versionIndexName");
            Ensure.NotNull(_commandIndexName, "_commandIndexName");
            Ensure.Positive(_bulkCopyBatchSize, "_bulkCopyBatchSize");
            Ensure.Positive(_bulkCopyTimeout, "_bulkCopyTimeout");

            _jsonSerializer = ObjectContainer.Resolve<IJsonSerializer>();
            _eventSerializer = ObjectContainer.Resolve<IEventSerializer>();
            _ioHelper = ObjectContainer.Resolve<IOHelper>();
            _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);

            SupportBatchAppendEvent = true;
        }
Example #13
0
        public SqlServerEventStore(OptionSetting optionSetting)
        {
            Ensure.NotNull(optionSetting, "optionSetting");

            _connectionString = optionSetting.GetOptionValue<string>("ConnectionString");
            _tableName = optionSetting.GetOptionValue<string>("TableName");
            _primaryKeyName = optionSetting.GetOptionValue<string>("PrimaryKeyName");
            _commandIndexName = optionSetting.GetOptionValue<string>("CommandIndexName");
            _bulkCopyBatchSize = optionSetting.GetOptionValue<int>("BulkCopyBatchSize");
            _bulkCopyTimeout = optionSetting.GetOptionValue<int>("BulkCopyTimeout");

            Ensure.NotNull(_connectionString, "_connectionString");
            Ensure.NotNull(_tableName, "_tableName");
            Ensure.NotNull(_primaryKeyName, "_primaryKeyName");
            Ensure.NotNull(_commandIndexName, "_commandIndexName");
            Ensure.Positive(_bulkCopyBatchSize, "_bulkCopyBatchSize");
            Ensure.Positive(_bulkCopyTimeout, "_bulkCopyTimeout");

            _jsonSerializer = ObjectContainer.Resolve<IJsonSerializer>();
            _eventSerializer = ObjectContainer.Resolve<IEventSerializer>();
            _ioHelper = ObjectContainer.Resolve<IOHelper>();
            _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
        }
        public async Task Initialize(RemoteRelayConfiguration configuration)
        {
            try
            {
                Configuration    = configuration;
                _handler         = configuration.Handler;
                _eventSerializer = configuration.EventSerializer;

                Connection = new HubConnectionBuilder()
                             .WithUrl(Configuration.ServerURL, HttpTransportType.WebSockets)
                             .AddMessagePackProtocol()
                             .Build();

                Connection.Closed += Connection_Closed;

                await Connection.StartAsync();

                IsConnected = true;

                _localClientInfo = new ClientInfo()
                {
                    ClientIdentifier = Guid.NewGuid().ToString(), HostType = HostType.TouchscreenWall
                };

                await Connection.SendAsync(nameof(IRelayHub.RegisterClient), _localClientInfo);

                await Connection.SendAsync(nameof(IRelayHub.GetOnlineClients), _localClientInfo);

                RegisterRemoteEvents();
                PrepareEventHubs();
            }
            catch (Exception ex)
            {
                Debug.Log($"[RMEOTE] Did not connect to server. Reason: {ex.Message}");
            }
        }
Example #15
0
 public EventStore(IStreamStore streamStore, IEventSerializer eventSerializer)
 {
     _streamStore     = streamStore ?? throw new ArgumentNullException(nameof(streamStore));
     _eventSerializer = eventSerializer ?? throw new ArgumentNullException(nameof(eventSerializer));
 }
Example #16
0
 void SaveEventsAtOnce(string stream_name, int expected_version,
   IEnumerable<Event> events, IEventSerializer serializer) {
   connection_.AppendToStream(stream_name, expected_version,
     Serialize(events, serializer));
 }
Example #17
0
 public EventStorage(IEventSerializer serializer, IDatabaseConfig dbConfig)
 {
     _serializer = serializer;
     _dbConfig = dbConfig;
 }
Example #18
0
 IEnumerable<EventData> Serialize(IEnumerable<Event> events,
   IEventSerializer serializer) {
   return events.Select(e => {
     var event_id = Guid.NewGuid();
     var type = e.GetType().Name;
     var serialized = serializer.Serialize(e);
     return new EventData(event_id, type, false, serialized.Data,
       serialized.Metadata);
   });
 }
Example #19
0
 public Builder WithSerializer(IEventSerializer serializer)
 {
     serializer_ = serializer;
     return(this);
 }
 public RemovedProductsDenormalizer(IProjectionRepository projectionRepository, IEventStore eventStore, IEventSerializer eventSerializer)
     : base(projectionRepository, eventStore, eventSerializer)
 {
 }
 protected Repository(IEventStore store, IKnownSerializers serializers)
 {
     _store             = store;
     _eventSerializer   = serializers.Events.Serializer;
     _eventDeserializer = serializers.Events.Deserializer;
 }
Example #22
0
 public MemoryEventPersistance(IEventSerializer serializer)
 {
     _serializer = serializer;
 }
Example #23
0
 public LogEventPublisher(ILog log, IEventSerializer serializer)
 {
     Log        = log;
     Serializer = serializer;
 }
        public EventContainerSerializer(IEventSerializer eventSerializer)
        {
            if (eventSerializer == null) throw new ArgumentNullException(nameof(eventSerializer));

            _eventSerializer = eventSerializer;
        }
Example #25
0
 public SimpleFilePersistenceEngine(IEventSerializer serializer, string storagePath)
 {
     _serializer = serializer;
     _storagePath = storagePath;
 }
 public EventStoreAsync(IAppendOnlyAsync appender, IEventSerializer serializer = null)
 {
     this.appender = appender;
     this.serializer = serializer ?? new BinaryFormatterSerializer();
 }
Example #27
0
 public EventStore(ITypeMapper typeMapper, IEventSerializer serializer, EventStoreOptions options)
 {
     _typeMapper = typeMapper ?? throw new ArgumentNullException(nameof(typeMapper));
     _serializer = serializer ?? throw new ArgumentNullException(nameof(serializer));
     _options    = options ?? throw new ArgumentNullException(nameof(options));
 }
Example #28
0
        public Session(
            ILoggerFactory loggerFactory,
            IEventStore eventStore,
            IEventPublisher eventPublisher,
            IEventSerializer eventSerializer,
            ISnapshotSerializer snapshotSerializer,
            IProjectionSerializer projectionSerializer,
            IProjectionProviderScanner projectionProviderScanner = null,
            IEventUpdateManager eventUpdateManager            = null,
            IEnumerable <IMetadataProvider> metadataProviders = null,
            ISnapshotStrategy snapshotStrategy           = null,
            IEventsMetadataService eventsMetadataService = null)
        {
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }
            if (eventStore == null)
            {
                throw new ArgumentNullException(nameof(eventStore));
            }
            if (eventPublisher == null)
            {
                throw new ArgumentNullException(nameof(eventPublisher));
            }
            if (eventSerializer == null)
            {
                throw new ArgumentNullException(nameof(eventSerializer));
            }
            if (snapshotSerializer == null)
            {
                throw new ArgumentNullException(nameof(snapshotSerializer));
            }
            if (projectionSerializer == null)
            {
                throw new ArgumentNullException(nameof(projectionSerializer));
            }

            if (metadataProviders == null)
            {
                metadataProviders = Enumerable.Empty <IMetadataProvider>();
            }

            metadataProviders = metadataProviders.Concat(new IMetadataProvider[]
            {
                new AggregateTypeMetadataProvider(),
                new EventTypeMetadataProvider(),
                new CorrelationIdMetadataProvider()
            });

            if (projectionProviderScanner == null)
            {
                projectionProviderScanner = new ProjectionProviderAttributeScanner();
            }

            if (snapshotStrategy == null)
            {
                snapshotStrategy = new IntervalSnapshotStrategy();
            }

            if (eventsMetadataService == null)
            {
                eventsMetadataService = new EventsMetadataService();
            }

            _logger = loggerFactory.Create(nameof(Session));

            _snapshotStrategy          = snapshotStrategy;
            _eventStore                = eventStore;
            _eventSerializer           = eventSerializer;
            _snapshotSerializer        = snapshotSerializer;
            _projectionSerializer      = projectionSerializer;
            _eventUpdateManager        = eventUpdateManager;
            _projectionProviderScanner = projectionProviderScanner;
            _metadataProviders         = metadataProviders;
            _eventPublisher            = eventPublisher;
            _eventsMetadataService     = eventsMetadataService;
        }
Example #29
0
 public EventStore(ITypeMapper typeMapper, IEventSerializer eventSerializer, DbContextOptions <EventStore> options) : base(options)
 {
     _typeMapper      = typeMapper ?? throw new ArgumentNullException(nameof(typeMapper));
     _eventSerializer = eventSerializer ?? throw new ArgumentNullException(nameof(eventSerializer));
 }
 /// <summary>
 /// Create a new EventStoreDB producer instance
 /// </summary>
 /// <param name="clientSettings">EventStoreDB gRPC client settings</param>
 /// <param name="stream">Stream name, where the events will be produced</param>
 /// <param name="serializer">Event serializer instance</param>
 public EventStoreProducer(EventStoreClientSettings clientSettings, string stream, IEventSerializer serializer)
     : this(new EventStoreClient(Ensure.NotNull(clientSettings, nameof(clientSettings))), stream, serializer)
 {
 }
Example #31
0
 public EventStoreWrapper(IEventStoreConnectionProvider connectionProvider, IEventSerializer eventSerializer)
 {
     _connectionProvider = connectionProvider;
     _eventSerializer    = eventSerializer;
 }
 public EventStoringSubscriber(IStoredEventRepository storedEventRepository, IEventSerializer eventSerializer)
 {
     _storedEventRepository = storedEventRepository;
     _eventSerializer       = eventSerializer;
 }
 /// <summary>
 /// Create a new EventStoreDB producer instance
 /// </summary>
 /// <param name="eventStoreClient">EventStoreDB gRPC client</param>
 /// <param name="serializer">Event serializer instance</param>
 public EventStoreProducer(EventStoreClient eventStoreClient, IEventSerializer serializer)
 {
     _client     = Ensure.NotNull(eventStoreClient, nameof(eventStoreClient));
     _serializer = Ensure.NotNull(serializer, nameof(serializer));
 }
Example #34
0
 public EventMapper(IEventSerializer serializer)
 {
     this.serializer = serializer;
 }
Example #35
0
        protected MongoDenormalizer(IProjectionRepository repository, IEventStore eventStore, IEventSerializer eventSerializer)
        {
            Repository       = repository;
            _eventStore      = eventStore;
            _eventSerializer = eventSerializer;

            var denormalizerType = GetType();

            if (!_denormalizerEventTypes.ContainsKey(denormalizerType))
            {
                var eventTypes = GetType().GetTypeInfo().GetInterfaces()
                                 .Where(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IEventHandler <>))
                                 .SelectMany(i => i.GetGenericArguments())
                                 .ToList();
                _denormalizerEventTypes.TryAdd(denormalizerType, eventTypes);

                var eventHandlerMethods = denormalizerType.GetTypeInfo()
                                          .GetMethods(BindingFlags.Instance | BindingFlags.Public)
                                          .Where(x => x.ReturnType == typeof(Task) && x.GetParameters().Length == 1 &&
                                                 eventTypes.Contains(x.GetParameters()[0].ParameterType));

                var eventHandlerDelegates = new Dictionary <Type, Func <object, object, Task> >();
                foreach (var method in eventHandlerMethods)
                {
                    var eventType       = method.GetParameters()[0].ParameterType;
                    var instanceParam   = Expression.Parameter(typeof(object), "instance");
                    var eventParam      = Expression.Parameter(typeof(object), "event");
                    var handlerDelegate = Expression.Lambda <Func <object, object, Task> >(
                        Expression.Call(Expression.Convert(instanceParam, denormalizerType), method, Expression.Convert(eventParam, eventType)), instanceParam, eventParam)
                                          .Compile();
                    eventHandlerDelegates.Add(eventType, handlerDelegate);
                }
                _denormalizerEventHandlers.TryAdd(denormalizerType, eventHandlerDelegates);
            }
        }
Example #36
0
 public AggregateStore(IEventStore eventStore, IEventSerializer serializer)
 {
     _eventStore = Ensure.NotNull(eventStore, nameof(eventStore));
     _serializer = Ensure.NotNull(serializer, nameof(serializer));
 }
Example #37
0
 public EventStore(ICrudRepository crudRepository,
                   IEventSerializer eventSerializer)
 {
     this.crudRepository  = crudRepository;
     this.eventSerializer = eventSerializer;
 }
 public CartDenormalizer(IProjectionRepository projectionRepository, IEventStore eventStore, IEventSerializer eventSerializer)
     : base(projectionRepository, eventStore, eventSerializer)
 {
 }
 /// <summary>
 /// Create a new EventStoreDB producer instance
 /// </summary>
 /// <param name="eventStoreClient">EventStoreDB gRPC client</param>
 /// <param name="stream">Stream name, where the events will be produced</param>
 /// <param name="serializer">Event serializer instance</param>
 public EventStoreProducer(EventStoreClient eventStoreClient, string stream, IEventSerializer serializer)
 {
     _client     = Ensure.NotNull(eventStoreClient, nameof(eventStoreClient));
     _stream     = Ensure.NotEmptyString(stream, nameof(stream));
     _serializer = Ensure.NotNull(serializer, nameof(serializer));
 }
 public EventStoreApplicationService(EventStoreClient eventStore, IEventSerializer eventSerializer)
 {
     _eventStore      = eventStore;
     _eventSerializer = eventSerializer;
 }
 public EventSourcingHandler(IEventStoreRepository <T> eventStoreRepository,
                             IEventSerializer eventSerializer)
 {
     _eventStoreRepository = eventStoreRepository;
     _eventSerializer      = eventSerializer;
 }
 public SqlEventStore(IEventSerializer eventSerializer, IEventStamping eventStamping)
 {
     _eventSerializer = eventSerializer ?? throw new ArgumentNullException(nameof(eventSerializer));
     _eventStamping   = eventStamping ?? throw new ArgumentNullException(nameof(eventStamping));
 }
Example #43
0
 Event Deserialize(ResolvedEvent @event, IEventSerializer serializer) {
   var e = serializer.Deserialize(
     new EventData(
       @event.OriginalEvent.EventId, @event.OriginalEvent.EventType,
       false, @event.OriginalEvent.Data,
       @event.OriginalEvent.Metadata));
   e.Version = @event.Event.EventNumber;
   return e;
 }
 public GenericEventRepository(ISession session, IEventSerializer serializer)
 {
     _session    = session;
     _serializer = serializer;
 }
 public DatabaseEventSubscriber(DatabaseConfiguration configuration, IEventSerializer serializer)
 {
     _configuration = configuration;
     _serializer    = serializer;
 }
Example #46
0
 public EventStorage(IEventSerializer serializer, IDatabaseConfig dbConfig)
 {
     _serializer = serializer;
     _dbConfig   = dbConfig;
 }
Example #47
0
 public IList<Event> GetEventsForAggregate(Guid aggregate_id,
   IEventSerializer serializer) {
   return GetEventsForAggregate(aggregate_id, serializer, int.MaxValue);
 }
Example #48
0
 public AsyncEventQueueRecordAdapter(QueuedAsyncEvent queuedEvent, IEventSerializer eventSerializer)
 {
     this.queuedEvent     = queuedEvent;
     this.eventSerializer = eventSerializer;
 }
Example #49
0
    void SaveEventsInBatch(string stream_name, int expected_version,
      IEnumerable<Event> events, IEventSerializer serializer) {
      EventStoreTransaction trasaction = connection_
        .StartTransaction(stream_name, expected_version);
      EventData[] serialized_events = Serialize(events, serializer).ToArray();

      int position = 0;
      while (position < serialized_events.Length) {
        var page_events = serialized_events
          .Skip(position)
          .Take(kWritePageSize);
        trasaction.Write(page_events);
        position += kWritePageSize;
      }
      trasaction.Commit();
    }
		public EventStoringSubscriber(IStoredEventRepository storedEventRepository, IEventSerializer eventSerializer)
		{			
			_storedEventRepository = storedEventRepository;
			_eventSerializer = eventSerializer;
		}
Example #51
0
 public ObservableListenerHandler(NotificationContext context, INotificationHandler <TEvent> handler, IEventSerializer <TEvent> serializer)
 {
     _context    = context;
     _handler    = handler;
     _serializer = serializer;
 }
 public InMemoryEventCache(IEventIdProvider eventIdProvider, IEventSerializer eventSerializer)
 {
     _cache           = new ConcurrentDictionary <string, SortedList <long, EventCacheItem> >();
     _eventIdProvider = eventIdProvider;
     _eventSerializer = eventSerializer;
 }
Example #53
0
 protected BaseFunction(IEventSerializer eventSerializer, IMediator mediator)
 {
     _eventSerializer = eventSerializer ?? throw new ArgumentNullException(nameof(eventSerializer));
     _mediator        = mediator ?? throw new ArgumentNullException(nameof(mediator));
 }
Example #54
0
 public MySqlEventStore(IEventSerializer eventSerializer)
 {
     _eventSerializer = eventSerializer;
 }
 public SqlStreamStoreStreamReader(ISqlStreamStoreProvider streamStoreProvider, IEventSerializer eventSerializer)
 {
     _streamStoreProvider = streamStoreProvider;
     _eventSerializer     = eventSerializer;
 }
Example #56
0
 public SqlServerEventStore(IEventSerializer eventSerializer)
 {
     _eventSerializer = eventSerializer;
 }