Skip to content

Message received callback in desktop applications #404

Answered by Havret
pgarbo asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @pgarbo,

There is nothing built-in unfortunately, but you should be able to use DependencyInjection extensions package even in desktop/console apps. You just need to include Microsoft.Extensions.DependencyInjection so you have access to ServiceCollection and ServiceProvider types.

class Program
{
    static async Task Main()
    {
        var endpoint = Endpoint.Create("localhost", 5672, "guest", "guest");
        var serviceCollection = new ServiceCollection();
        var activeMqBuilder = serviceCollection.AddActiveMq("my-broker", new[] { endpoint });
        activeMqBuilder.AddConsumer("my-address", RoutingType.Multicast, async (message, consumer, serviceProvider, cancellationToken) 

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by pgarbo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants