title: Synchronous Consumer with JMS Queue
body: <p>I want to process all the messages from a JMS Queue in Glassfish 3 in a synchronous way so I have tried to change the property Maximum Active Consumers from -1 to 1 in JMS Physical Destination in Glassfish window. I think setting this I will have only one Consumer executing OnMessage() at the same time. The problem I have reached its that when I change that property I got this error:</p>
  
  <pre><code>[I500]: Caught JVM Exception: org.xml.sax.SAXParseException: Content is not allowed in prolog.
  
  [I500]: Caught JVM Exception: com.sun.messaging.jms.JMSException: Content is not allowed in prolog.
  
  sendMessage Error [C4038]: com.sun.messaging.jms.JMSException: Content is not allowed in prolog.
  </code></pre>
  
  <p>If anyone know another way to make the method onmessage() synchronous will be appreciated. This is my Consumer Class:</p>
  
  <pre><code>@MessageDriven(mappedName = "QueueListener", activationConfig = {
  @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
  @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
  })
  public class MessageBean implements MessageListener {
  
  
  
  @Override
  public void onMessage(Message message) {
      long t1 = System.currentTimeMillis();
      write("MessageBean has received " + message);
      try{
  
          TextMessage result=(TextMessage)message;
          String text=result.getText();
          write("OTAMessageBean message ID has resolved to " + text);
          int messageID=Integer.valueOf(text);
  
          AirProcessing aP=new AirProcessing();
          aP.pickup(messageID);
  
  
      }
      catch(Exception e){
          raiseError("OTAMessageBean error " + e.getMessage());
      }
     long t2 = System.currentTimeMillis();
     write("MessageBean has finished in " + (t2-t1)); 
  
  }
  
  
  
  }
  </code></pre>