![]() _logger.LogInformation("Request received.") Īwait context.RespondAsync(new ) įor the purposes of this example I chose to use the Worker Service hosted service lifetime events to start and stop the MassTransit bus. Public async Task Consume(ConsumeContext context) Public class Request2Consumer : IConsumer Note that I setup a simple message consumer which would respond using request response, just for testing purposes. ServiceCollectionConfigurator.AddBus(serviceProvider =>īus.Factory.CreateUsingAmazonSqs(busFactor圜onfigurator =>īusFactor圜onfigurator.Host("eu-west-2", h =>īusFactor圜onfigurator.ReceiveEndpoint("responder2_request2_endpoint",ĮndpointConfigurator.Consumer(serviceProvider) ServiceCollectionConfigurator.AddConsumer() ![]() Services.AddMassTransit(serviceCollectionConfigurator => ConfigureServices((hostContext, services) => Private static IHostBuilder CreateHostBuilder(string args) => Logger.LogInformation("Responder2 running.") Var host = CreateHostBuilder(args).Build() However, I chose not to start the bus at this point but rather use the Worker Service lifetime events to do that (described later). I was then able to configure the MassTransit bus using dependency injection. I also added support to deploy the Worker Service as a systemd daemon. First up I installed a few NuGet packages to enable MassTransit using AWS SQS transport, and support for dependency injection. I created a Worker Service using Visual Studio and adapted the template project to suit. Again, to reiterate my approach almost certainly isn’t best practice but served only to demonstrate the feasibility of the approach. To use AWS SQS as the transport for MassTransit.To test a MassTransit-based Worker Service running on a Linux host as a systemd daemon.To test a MassTransit-based Worker Service running in a Linux container using Docker.NB: This is all “hello world” style code so don’t look here for the best way to do things. Net Core 3.1 Worker Service running on Linux. The code contained herein was just sufficient to answer some basic questions around whether a MassTransit-based endpoint could be hosted in a. Be aware, this blog post contains my notes on some investigation work I recently undertook with MassTransit, the open source service bus for.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |