public DispatcherBase(IMongoRepository mongoRepository, IGESConnection gesConnection, List <IHandler> eventHandlers) { _mongoRepository = mongoRepository; _gesConnection = gesConnection.BuildConnection(); _gesConnection.ConnectAsync(); _eventHandlers = eventHandlers; // add all handlers to the broadcast block so they receive news of events RegisterHandlers(); // gets last event processed to avoid re processing events after a shut down. GetLastEventProcessedForHandlers(); }
public DispatcherBase(IMongoRepository mongoRepository, IGESConnection gesConnection, List<IHandler> eventHandlers) { _mongoRepository = mongoRepository; _gesConnection = gesConnection.BuildConnection(); _gesConnection.ConnectAsync(); _eventHandlers = eventHandlers; // add all handlers to the broadcast block so they receive news of events RegisterHandlers(); // gets last event processed to avoid re processing events after a shut down. GetLastEventProcessedForHandlers(); }
public CommandDispatcher(IMongoRepository mongoRepository, IGESConnection gesConnection, List<IHandler> eventHandlers) : base(mongoRepository, gesConnection, eventHandlers) { _targetClrTypeName = "CommandClrTypeName"; _eventFilter = x => { if (x.OriginalEvent.Metadata.Length <= 0 || x.OriginalEvent.Data.Length <= 0) { return false; } var jProperty = Newtonsoft.Json.Linq.JObject.Parse(Encoding.UTF8.GetString(x.Event.Metadata)).Property(_targetClrTypeName); return !x.Event.EventType.StartsWith("$") && jProperty!=null && jProperty.HasValues; }; }
public CommandDispatcher(IMongoRepository mongoRepository, IGESConnection gesConnection, List <IHandler> eventHandlers) : base(mongoRepository, gesConnection, eventHandlers) { _targetClrTypeName = "CommandClrTypeName"; _eventFilter = x => { if (x.OriginalEvent.Metadata.Length <= 0 || x.OriginalEvent.Data.Length <= 0) { return(false); } var jProperty = Newtonsoft.Json.Linq.JObject.Parse(Encoding.UTF8.GetString(x.Event.Metadata)).Property(_targetClrTypeName); return(!x.Event.EventType.StartsWith("$") && jProperty != null && jProperty.HasValues); }; }