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);
        }
示例#2
0
        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);
        }