Reputation: 31
I want to defer a message that is meant to be published, but Rebus returns the message to the sending queue. I was expecting it to send them to the actual recipients.
Am I doing something wrong here or have I understood the defer-function wrong?
Upvotes: 3
Views: 490
Reputation: 18628
That's how bus.Defer
works - it'll send the message to the return address specified in the Headers.ReturnAddress
header of the message, which by default is set to the input queue of the sender.
You can have the timeout manager send the message somewhere else by explicitly setting the return address of the message like so:
// specify which address to reply to
bus.AttachHeader(msg, Headers.ReturnAddress, "somewhereelse");
// defer the message
bus.Defer(toTheFuture, msg);
but in your case, since you want the message to be published, I suggest you just add a local handler that publishes the message when it's returned from the timeout manager.
Upvotes: 3