using System; using System.Net.Http; using System.Threading.Tasks; using Billing.Contracts; using NServiceBus; using Sales.Contracts; using Shipping.Contracts; namespace Shipping { public class CreateShippingLabelHandler : IHandleMessages<CreateShippingLabel> { private readonly IHttpClientFactory _httpClientFactory; public CreateShippingLabelHandler(IHttpClientFactory httpClientFactory) { _httpClientFactory = httpClientFactory; } public async Task Handle(CreateShippingLabel message, IMessageHandlerContext context) { var httpClient = _httpClientFactory.CreateClient(); var result = await httpClient.GetAsync("https://fedex.com"); // Reply await context.Reply(new ShippingLabelCreated { OrderId = message.OrderId }); } } }