public async Task InvokeAsync(HttpContext httpContext) { var product = new ProductCreated() { Id = Guid.NewGuid(), Name = Guid.NewGuid().ToString() }; await _eventPublisher.PublishMessage <ProductCreated>(product); await _next(httpContext); }
private IList <Message> FetchPendingMessages() { if (FakeDbContext.Messages.Count <= 0) { var product = new ProductCreated() { Id = Guid.NewGuid(), Name = Guid.NewGuid().ToString() }; FakeDbContext.Messages.Add(new Message(product)); } List <Message> messagesToPush = FakeDbContext.Messages.Take(50).ToList(); return(messagesToPush); }