I'm trying to write a dead letter handler service that reads messages off of a dead letter queue and then does something with the message based on the type, contents, etc.
In my C# application, I'm using EasyNetQ. I have a basic message type called MyMessage, and then a number of subtypes. EasyNetQ doesn't have a problem serializing the messages, sending them to an exchange, pulling them off the queue and then deserializing the message back into the original type.
However, if I setup the AdvancedBus in my dead letter handler to consume from the dead letter queue using MyMessage type, dead letter messages start going into the error queue instead of the dead letter queue. Apparently, the message gets changed somehow when it dead letters and can no longer be deserialized.
Is there any way to get around this?
Edit:
I may be even fundamentally misunderstanding the problem. If there's no EasyNetQ consumer on the queue, the dead letter queue works as expected, but as soon as there's a consumer, it chokes and starts putting all messages in the error queue. I even tried consuming the base IMessage type instead of my type. No difference. It still errors.