title: how to mark a message as persistent using spring-rabbitmq?
body: <p>This is how I'm creating an exchange and binding a queue to it </p>
  
  <pre><code>&lt;rabbit:topic-exchange id="dataExchange" name="MQ-EXCHANGE" durable="true"&gt;
          &lt;rabbit:bindings&gt;
              &lt;rabbit:binding queue="COMM_QUEUE" pattern="queue.*" /&gt;
          &lt;/rabbit:bindings&gt;
  &lt;/rabbit:topic-exchange&gt;
  </code></pre>
  
  <p>I have read a lot of posts on the Internet where it is written that a message is also needed to be marked persistent if it is to be secured in case rabbitmq or the queue crashes. But I couldn't figure out how to mark my messages persistent.</p>
  
  <p>This is how I'm publishing the messages to the queue</p>
  
  <pre><code>    @Autowired
      private RabbitTemplate template;
  
      @Override
      public void produceMessage(Object message, String routingKey) {
          template.convertAndSend(routingKey, message);  
      }
  </code></pre>
  
  <p>I looked for different API methods to know this and also tried to look for any specific property that I could configure in the XML but couldn't find a way. Any guidance ?</p>