I could just write a long-running CLI app and run it, but I\'m assuming it wouldn\'t comply to all the expectations one would have of a standards-compliant linux daemon (respond
If you're trying to find something more robust, I found an implementation on Github that looks promising: .NET Core Application blocks for message-based communication. It uses Host
, HostBuilder
, ApplicationServices
, ApplicationEnvironment
, etc classes to implement a messaging service.
It doesn't quite look ready for black box reuse, but it seems like it could be a good starting point.
var host = new HostBuilder()
.ConfigureServices(services =>
{
var settings = new RabbitMQSettings { ServerName = "192.168.80.129", UserName = "admin", Password = "Pass@word1" };
})
.Build();
Console.WriteLine("Starting...");
await host.StartAsync();
var messenger = host.Services.GetRequiredService();
Console.WriteLine("Running. Type text and press ENTER to send a message.");
Console.CancelKeyPress += async (sender, e) =>
{
Console.WriteLine("Shutting down...");
await host.StopAsync(new CancellationTokenSource(3000).Token);
Environment.Exit(0);
};
...