title: Spring JMSTemplate - lost messages
body: <p>We are using Spring JMSTemplate 3.0.1RELEASE to send JMS messages to an ActiveMQ cluster.</p>
  
  <p>I am using useAsynSend=true to be able to send Asynchronous requests as these are all Fire and Forget. However they are still persistent and I can confirm they do get persisted on the AMQ Kaha-DB first and then forwarded on to Message Listeners. No CorelationID or JMSReplyTo as I am not listening back on any response.</p>
  
  <pre><code>   &lt;amq:connectionFactory id="amqJmsFactory"
      brokerURL="failover:(tcp://MY-SERVER-01:61616,tcp://MY-SERVER-02:61616)?randomize=true&amp;jms.useAsyncSend=true" /&gt;
  
  &lt;!-- JMS Producer Configuration --&gt;
  &lt;bean id="jmsProducerTemplate" class="org.springframework.jms.core.JmsTemplate"
      p:connectionFactory-ref="amqJmsFactory" /&gt;
  
    &lt;bean id="activeMQBinding" class="com.my.company.activemq.ActiveMQProductBinding"&gt;
      &lt;property name="template" ref="jmsProducerTemplate" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>In the ActiveMQProductBinding class we have the following method</p>
  
  <pre><code>  public void sendActiveMQMessageAsync(final Object message, String qName) {
      log.info("About to send message");
      template.send(qName, new MessageCreator() {
          public Message createMessage(Session session) throws JMSException {
              ObjectMessage objectMessage = session.createObjectMessage((Serializable) message);
  
              log.info("Sending message: " + objectMessage);
  
              return objectMessage;
          }
      });
  }
  </code></pre>
  
  <p>Now I can see in the logs that the logs are getting printed. No Exception is thrown. Still some messages are totally getting lost. It probably doesn't reach ActiveMQ. I have Mule JMS Listeners configured to listen to messages on the ActiveMQ queues defined by 'qName' above. Most of the messages get delivered to AMQ fine and Mule picks them up within fraction of a second. However it is only some messages which are getting lost. When I checked the Queues on ActiveMQ I can see all messages received have been dispatched fine to Mule. Hence I am suspecting the messages aren't reaching ActiveMQ at all or AMQ is rejecting. However no logs on JMSTemplate spring or ActiveMQ.</p>
  
  <p>The Message created looks like this (It is printed in the method above).</p>
  
  <pre><code>   2013-03-11 16:33:11,752 INFO [com.my.company.activemq.ActiveMQProductBinding$1] Sending message: ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId = null, originalDestination = null, originalTransactionId = null, producerId = null, destination = null, transactionId = null, expiration = 0, timestamp = 0, arrival = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null, replyTo = null, persistent = false, type = null, priority = 0, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@61408493, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = false, readOnlyBody = false, droppable = false}
  </code></pre>
  
  <p>Anything I am missing on JMSTemplate config or some behaviour on AMQ? Please help!</p>
  
  <p>Any help guys? </p>