title: How to set content-type for the reply in spring-amqp Request/Reply Messaging?
body: <p>I'm following the instructions for the <code>Stock Trading</code> sample, which outlines how to use request/reply messaging in <code>spring-amqp</code>: <a href="http://static.springsource.org/spring-amqp/docs/1.2.x/reference/html/sample-apps.html#d4e742" rel="nofollow">http://static.springsource.org/spring-amqp/docs/1.2.x/reference/html/sample-apps.html#d4e742</a></p>
  
  <p>Looking at the <code>ServerHandler</code> class which is a Message-driven POJO that happens to be also capable of sending reply Messages ... I don't see a place where we can inject MessageProperties for <code>content-type</code></p>
  
  <p>I've tweaked this sample and I want to return an xml message posing as a simple string ... but when <code>ServerHandler</code> posts my reply to RabbitMQ, it looks like:</p>
  
  <pre><code>properties:
    correlation_id:   9873f420-89e5-465d-aa60-ec9281ee48ae
    priority: 0
    delivery_mode:    2
    headers:  
      __TypeId__: java.lang.String
    content_encoding: UTF-8
    content_type: application/json
  
  payload:
    "&lt;?xml version='1.0' encoding='UTF-8'?&gt;\n&lt;stuff&gt;&lt;/stuff&gt;
  </code></pre>
  
  <p>And ultimately (my guess is) my client which should be reading this ... is unable to parse the object because of the <code>content_type</code> being set incorrectly to <code>application/json</code> and my usecase fails so I receive <code>null</code> back as the reply.</p>
  
  <p>Q) Does anyone know how to set content-type for the reply in spring-amqp Request/Reply Messaging?</p>
  
  <hr>
  
  <p>Update#1</p>
  
  <p>Q) Perhaps what I need is to make sure that <code>jsonMessageConverter</code> is only used for reading messages off of the requestQueue and not when I want to put back a reply onto the responseQueue ... any idea on how to configure that? This is a snippet from my current appContext.xml file:</p>
  
  <pre><code>&lt;listener-container
      concurrency="5"
      connection-factory="connectionFactory"
      message-converter="jsonMessageConverter"
      xmlns="http://www.springframework.org/schema/rabbit"&gt;
      &lt;listener ref="serverHandler" method="handleMessage" queue-names="#{queue.name}" /&gt;
  &lt;/listener-container&gt;
  </code></pre>