private void EnqueueReadModels(IReadModelQueueProducer queue, string aggregateType, IList <IAggregateEvent> events) { if (queue != null) { var groupedEvents = from evt in events group evt by evt.AggregateId into g select new { RootId = g.Key, Version = g.Min(x => x.Version) }; foreach (var g in groupedEvents) { var workItem = queue.Enqueue(g.RootId, aggregateType, g.Version); if (workItem != null) { var topic = new DomainTopic(this.registration.AggregateType, g.RootId); this.eventBus.Publish(new DomainNotification(topic, workItem)); } } } }
private void EnqueueReadModels(IReadModelQueueProducer queue, string aggregateType, IList<IAggregateEvent> events) { if (queue != null) { var groupedEvents = from evt in events group evt by evt.AggregateId into g select new { RootId = g.Key, Version = g.Min(x => x.Version)}; foreach (var g in groupedEvents) { var workItem = queue.Enqueue(g.RootId, aggregateType, g.Version); if (workItem != null) { var topic = new DomainTopic(this.registration.AggregateType, g.RootId); this.eventBus.Publish(new DomainNotification(topic, workItem)); } } } }