I am using DLQ with DLX for dead lettered messages in C# project.
I would like to store the exception that causes the message to be dead lettered in the dead letter header.
Is it possible to store data in the DLX header?
How to implement the SetConsumerExceptionHeader
method below?
consumer.Received += async (ch, ea) =>
{
try
{
Throw new Exception("some exception");
}
catch (Exception ex)
{
_logger.ErrorException($"Failed in Consumer_Received with error message {ex.Message}", ex);
** SetConsumerExceptionHeader**(ea.BasicProperties, e.ConsumerTag, ex);
channel.BasicNack(ea.DeliveryTag, false, false);
}
}