I'm using RabbitMq as one-way transport for a topic exchange
I configure timeouts to use external manager called "timeout.queue" in RabbitMq (which I had to create manually):
configurer.UseExternalTimeoutManager("timeout.queue")
This is how a send a message to defer:
var timeToSchedule = TimeSpan.FromSeconds(timeToScheduleInSeconds);
var headers = new Dictionary<string, string>
{
{ Headers.DeferredRecipient, "demo.consumer" },
{ Headers.ReturnAddress, "demo.consumer" }
};
await _bus.Defer(timeToSchedule, new EntityScheduled(), headers);
The problem is that when I defer the message, it's just kept in the timeout queue and no forwarding occurs.
I've been playing around with the headers too but not getting success.
"demo.consumer" is a queue bound to my intended topic exchange "defer.topic"
My guess is that you've forgotten a vital piece of your infrastructure: The "timeout manager".
With Rebus, a "timeout manager" is a normal Rebus endpoint that has a timeout storage configured
Configure.With(...)
.(...)
.Timeouts(t => t.StoreIn(...))
.(...)
e.g.
const string localDb = "server=.; database=rebus; trusted_connection=true";
Configure.With(...)
.(...)
.Timeouts(t => t.StoreInSqlServer(localDb, "RebusTimeouts"))
.(...)
In your case, it would be something like this:
const string localDb = "server=.; database=rebus; trusted_connection=true";
Configure.With(...)
.Transport(t => t.UseRabbitMq(rabbitConn, "timeout.queue"))
.Timeouts(t => t.StoreInSqlServer(localDb, "RebusTimeouts"))
.(...)
With a timeout manager installed, I bet your deferred messages will be sent as they should.