title: Maximum number of messages sent to a Queue in OpenMQ?
body: <p>I am currently using Glassfish v2.1 and I have set up a queue to send and receive messages from with Sesion beans and MDBs respectively. However, I have noticed that I can send only a maximum of 1000 messages to the queue. Is there any reason why I cannot send more than 1000 messages to the queue? I do have a "developer" profile setup for the glassfish domain. Could that be the reason? Or is there some resource configuration setting that I need to modify?</p>
  
  <p>I have setup the sun-resources.xml configuration properties as follows:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE resources PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Resource Definitions //EN" "http://www.sun.com/software/appserver/dtds/sun-resources_1_3.dtd"&gt;
  &lt;resources&gt;
    &lt;admin-object-resource
          enabled="true"
          jndi-name="jms/UpdateQueue"
          object-type="user"
          res-adapter="jmsra"
          res-type="javax.jms.Queue"&gt;
      &lt;description/&gt;
      &lt;property name="Name" value="UpdatePhysicalQueue"/&gt;
    &lt;/admin-object-resource&gt;
    &lt;connector-resource
          enabled="true" jndi-name="jms/UpdateQueueFactory"
          object-type="user"
          pool-name="jms/UpdateQueueFactoryPool"&gt;
      &lt;description/&gt;
    &lt;/connector-resource&gt;
    &lt;connector-connection-pool
          associate-with-thread="false"
          connection-creation-retry-attempts="0"
          connection-creation-retry-interval-in-seconds="10"
          connection-definition-name="javax.jms.QueueConnectionFactory"
          connection-leak-reclaim="false"
          connection-leak-timeout-in-seconds="0"
          fail-all-connections="false"
          idle-timeout-in-seconds="300"
          is-connection-validation-required="false"
          lazy-connection-association="false"
          lazy-connection-enlistment="false"
          match-connections="true"
          max-connection-usage-count="0"
          max-pool-size="32"
          max-wait-time-in-millis="60000"
          name="jms/UpdateFactoryPool"
          pool-resize-quantity="2"
          resource-adapter-name="jmsra"
          steady-pool-size="8"
          validate-atmost-once-period-in-seconds="0"/&gt;
  &lt;/resources&gt;
  </code></pre>
  
  <p>Hmm .. further investigation revealed the following in the imq logs:</p>
  
  <pre><code>   [17/Nov/2009:10:27:57 CST] ERROR sendMessage: Sending message failed. Connection ID: 427038234214377984:
      com.sun.messaging.jmq.jmsserver.util.BrokerException: transaction failed: [B4303]: The maximum number of messages [1,000] that the producer can process in a single transaction (TID=427038234364096768) has been exceeded. Please either limit the # of messages per transaction or increase the imq.transaction.producer.maxNumMsgs property.
  </code></pre>
  
  <p>So what would I do if I needed to send more than 5000 messages at a time?</p>
  
  <p>What I am trying to do is to read all the records in a table and update a particular field of each record based on the corresponding value of that record in a legacy table to which I have only read only access. This table has more than 10k records in it. As of now, I am sequentially going through each record in a for loop, getting the corresponding record from the legacy table, comparing the field values, updating the record if necessary and adding corresponding new records in other tables.</p>
  
  <p>However, I was hoping to improve performance by processing all the records asynchronously. To do that I was thinking of sending each record info as a separate message and hence requiring so many messages.</p>