Closed SilentBlueD666 closed 3 months ago
I've experienced the first issue, when specifying the exchange name in UseDelayedMessageExchange
an @ is appended to the declared exchange name (i.e RebusDelay is declared as @RebusDelay).
When attempted to defer a message, the RabbitMQ node errors stating the exchange RebusDelay does not exist.
Creating a (deferred) exchange RebusDelay manually solves the issue.
I've had a look at the code in the RabbitMqDelayedMessageExchangeExtensions class.
When setting the ExternalTimeoutManagerAddressOrNull
@ is appended to the exchange name (resulting in the exchange being declared with the @ prefix)
Within the Send method, when deferring the message ( here)
return _transport.Send($"{recipient}{_exchangeName}", message, context);
For an configured exchange RebusDelay (now @RebusDelay) and queue queue, the resultant routing key would be queue@RebusDelay, which when tokenised by the RabbitMQ transport results in original exchange name (minus the @ prefix), hence the error.
With a few minor changes the tests pass, if I've understood it correctly I could create a PR with the changes?
Good catch! Thanks to your thorough description it was easy for me to fix the problem.
It's out in Rebus.RabbitMq 9.2.1, which is on NuGet.org now 🙂
Brill my second problem did turn out to be the plug-in config error for Rabbit. I'll give the new package a go.
Thanks.
Hi Me again 😅
So I don't know if I am being dumb and just not getting it, so let me explain what I done and wonder if you can point me to where I am going wrong 😁 Note/context: I normally use SQL Timeout manager and been great for years but want to try and use RabbitMQ as the other day our SQL cluster was down, I use following pattern from Automatic retries and error handling so as you properly guested the messages didn't get deferred and ended up in the error queue. My idea is that if rabbit is down won't get the messages anyway so won't get the problem (outbox pattern used for sending).
I setup RabbitMQ 3.13.0 (in docker). Downloaded and installed RabbitMQ Delayed Message 3.12.0 Plugin
Setup Rebus with following:
Start application and the following exchange is created in RabbitMQ:
First thing I have noticed is the exchange was created with
@
prefixed to the name configured... not sure if this is meant to happen?The test code:
The point of this code is to keep looping the message forever until the problem is fixed (for reasons 😅).
However I get the following error when
await _bus.Advanced.TransportMessage.Defer(TimeSpan.FromMinutes(5));
line runs:So I think to my self that maybe the auto setup exchange is wrong, so I tried to delete the auto created exchange, and tell Rebus not to create and manually setup without the prefix:
Now I get the following error message:
In the docker terminal I also notice the following error:
2024-02-24 14:20:50 2024-02-24 14:20:50.356496+00:00 [error] <0.18899.0> ** Generic server <0.18899.0> terminating
And the exchange now has a binding:
Not sure where to go from here 😅