Exemple #1
0
        public async Task SendBookRequest(int booksCount)
        {
            var message = new BooksRequest(booksCount);

            var hostConfig = new MassTransitConfiguration();

            _configuration.GetSection("MassTransit").Bind(hostConfig);
            var endpoint = await _sendEndpointProvider.GetSendEndpoint(hostConfig.GetQueueAddress("book-shop-queue"));

            await endpoint.Send(message);
        }
        public async Task SendBooksToQueue(List <IBooksResponse.Book> books)
        {
            var message = new BooksResponse {
                Books = books
            };
            var hostConfig = new MassTransitConfiguration();

            _configuration.GetSection("MassTransit").Bind(hostConfig);
            var endpoint = await _sendEndpointProvider.GetSendEndpoint(hostConfig.GetQueueAddress("books-delivery-queue"));

            await endpoint.Send(message);
        }
        public async Task SentBookRequest(int bookCount)
        {
            Console.Out.WriteLine("Запрос на книги");
            var message = new BookRequest(bookCount);

            var hostConfig = new MassTransitConfiguration();

            _configuration.GetSection("MassTransit").Bind(hostConfig);
            var endpoint = await _sendEndpointProvider.GetSendEndpoint(hostConfig.GetQueueAddress("book-shop-queue"));

            await endpoint.Send(message);
        }