WolverineFx Conventional routing message transfer problem

3 weeks ago 19
ARTICLE AD BOX

I'm a newbie in Message Queues, so, for my current task I choose WolverineFX framework.

So, the task: I have one service which produces orders (simple algotrading strategy based on state machine) and send them to RabbitMQ. 2 other microservices must get messages and write data to console or telegram. Nothing serious.

So, as I mentioned, I try to use for this WolverineFX+RabbitMQ. RabbitMQ was rented on cloudampq (free version).

Here the configuration of my listener:

builder.UseWolverine(opts => { opts.ApplicationAssembly = typeof(Program).Assembly; opts.UseRabbitMq(messageBusConfiguration!.ConnectionString) .EnableWolverineControlQueues() .DisableDeadLetterQueueing() .UseConventionalRouting(config => { string projectName = Assembly.GetEntryAssembly().GetName().Name; config.QueueNameForListener(type => $@"{type.FullName}_{projectName}").ConfigureListeners((cfg, ctx) => { cfg.BindToExchange(ExchangeType.Topic, "LoggerExchange", $@"{ctx.MessageType.FullNameInCode()}"); }); }) .ConfigureListeners(c => c.ConfigureQueue(t => { t.AutoDelete = true; t.IsDurable = false; })) .AutoProvision(); opts.UseSystemTextJsonForSerialization(); opts.UnknownMessageBehavior = UnknownMessageBehavior.LogOnly; opts.DefaultExecutionTimeout = TimeSpan.FromMinutes(5); opts.DefaultRemoteInvocationTimeout = TimeSpan.FromMinutes(5); opts.Policies.UseDurableInboxOnAllListeners(); opts.Policies.UseDurableOutboxOnAllSendingEndpoints(); opts.Services.AddResourceSetupOnStartup(); });

Dummy handler:

[WolverineHandler] public sealed class OrderLoggingHandler { public async Task HandleAsync(Order message) { Console.WriteLine("Order came"); } }

and this is the publisher configuration:

builder.UseWolverine(opts => { opts.ApplicationAssembly = typeof(Program).Assembly; opts.UseRabbitMq(messageBusConfiguration!.ConnectionString) .AutoProvision() .DisableDeadLetterQueueing() .UseConventionalRouting(config => { config.ExchangeNameForSending(type => "LoggerExchange") .ConfigureSending((cfg, ctx) => cfg.ExchangeType(ExchangeType.Topic)); }); //.BindExchange("LoggerExchange", c => c.ExchangeType = ExchangeType.Topic); opts.UseSystemTextJsonForSerialization(); opts.DefaultExecutionTimeout = TimeSpan.FromMinutes(5); opts.DefaultRemoteInvocationTimeout = TimeSpan.FromMinutes(5); opts.Services.AddResourceSetupOnStartup(); });

But no reaction in listeners on published message via bus.Publish(...).

This is an exchange created as Topic Exchange

enter image description here

All binding correct

This is automatically generated queue.

enter image description here

But cannot receive any message. What's the reason, maybe who know. Thank you.

Read Entire Article