public DatasourcesContainer(IDatasourcesFabric datasourcesFabric, ISystemConfig configProvider, IEventQueueWriter eventQueue, IGameStorageClient gameStorage) : base(configProvider) { _datasourcesFabric = datasourcesFabric; _eventQueue = eventQueue; _gameStorage = gameStorage; }
public async Task CheckUpdate(IEventQueueWriter queue, IGameStorageReader storage, CancellationToken cancellationToken) { var dt = DateTime.UtcNow; var games3days = new List <Game>(); for (int i = 0; i < 3; i++) { var date = (new DateTime(dt.Year, dt.Month, dt.Day)).AddDays(i); var gameDescriptors = await GetInfoByDate(date); var filteredGameDescriptors = FilterLocal(gameDescriptors); var games = await Resolve(filteredGameDescriptors, storage); games3days.AddRange(games); } if (games3days.Any()) { await queue.Enqueue(games3days); } }
public async Task CheckUpdate(IEventQueueWriter queue, IGameStorageReader storage, CancellationToken cancellationToken) { var index1 = _rnd.Next(0, 9); var index2 = _rnd.Next(0, 8); if (index1 == index2) { index2 = 9; } var teams = (await storage.ResolveTeamByName(new[] { _teams[index1], _teams[index2] }, Guid.Empty)) .Select(x => x.Value) .ToArray(); var game = new Game { CompetitionTypeId = "wc", Team1Id = teams[0].Id, Team2Id = teams[1].Id, Time = DateTime.UtcNow.AddSeconds(5) }; await queue.Enqueue(new[] { game }); }
/// <summary> /// Creates a domin execution instance that can fully process command handlers and any configured event handlers /// including recursive handling of any commands generated by process managers. /// </summary> /// <param name="boundedContextModel">Describes the static model of the domain. Include the command handlers and any event handlers to be executed in process.</param> /// <param name="eventStore">The event store used for event persistence by both command and event handers.</param> /// <param name="eventQueueWriter">An event sink for writing the event output to a queue or similiar from within the command processing transaction.</param> /// <param name="isRuntimeModelCached">Is the runtime moel cached between calls, only set this true for single instance deployments.</param> /// <returns>Domain inteface for processing commands.</returns> public static IDomainEngine CreateDomainExecutionEngine(IBoundedContextModel boundedContextModel, IEventStore eventStore, IEventQueueWriter eventQueueWriter, DomainOptions options) { return(new DomainEngine(boundedContextModel, eventStore, options).WithEventBroker().WithEventQueue(eventQueueWriter)); //var domainEngine = new DomainExecutionEngine(boundedContextModel, eventStore).WithEventQueue(eventQueueWriter); //domainEngine.IsRuntimeModelCached = isRuntimeModelCached; //return domainEngine; }
/// <summary> /// Informs the domain engine to before returning the events generated by processign a command to first enqueue each event onto an external queue, this enque happens within /// the domain engine transaction. /// </summary> /// <param name="eventQueue">The event queue target. </param> /// <returns>Domain inteface for processing commands.</returns> public DomainEngine WithEventQueue(IEventQueueWriter eventQueue) { this.eventQueue = eventQueue; return(this); }