Search code examples
c#.netrabbitmqbrighter

How to make sure Rabbit MQ messages are sent with delivery mode "persistent" with Paramore Brighter


I am using Paramore Brighter.Net for consuming Rabbit Message Queue. I want to set the delivery mode of the message to "persistent". I did no get any property in brighter namespace that can internally set the rabbit mq delivery mode.

RMQMessageGateway class has IModel reference which internally has CreateBasicProperties method which i can use to set the delivery mode property. However the property's access specifier is protected and I am unable to set it. Kindly helpenter image description here.


Solution

  • You can take a clone of their code and modify it since their license model is MIT. Channel is actually set inside the ConnectToBroker method so you can make your changes there.

    If you don't want to modify their code, you can derive a new class from RMQMessageGateway and override ConnectToBroker. Then do whatever post actions there such as setting the delivery mode.