首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在OpenMQ中发送到队列的最大消息数?

在OpenMQ中发送到队列的最大消息数?
EN

Stack Overflow用户
提问于 2009-11-14 22:33:23
回答 1查看 6K关注 0票数 1

我目前正在使用Glassfish v2.1,我已经设置了一个队列,分别使用Sesion bean和MDB发送和接收消息。但是,我注意到最多只能向队列发送1000条消息。我为什么不能向队列发送超过1000条消息呢?我有一个“开发人员”配置文件设置的玻璃鱼领域。这就是原因吗?或者我需要修改哪些资源配置设置?

我已经按照以下方式设置了sun-resources.xml es.xml配置属性:

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<!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">
<resources>
  <admin-object-resource
        enabled="true"
        jndi-name="jms/UpdateQueue"
        object-type="user"
        res-adapter="jmsra"
        res-type="javax.jms.Queue">
    <description/>
    <property name="Name" value="UpdatePhysicalQueue"/>
  </admin-object-resource>
  <connector-resource
        enabled="true" jndi-name="jms/UpdateQueueFactory"
        object-type="user"
        pool-name="jms/UpdateQueueFactoryPool">
    <description/>
  </connector-resource>
  <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"/>
</resources>

嗯..。进一步调查发现,imq日志中有以下内容:

代码语言:javascript
复制
   [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.

那么,如果我需要一次发送超过5000条消息,我会做什么呢?

我想要做的是读取一个表中的所有记录,并根据仅具有只读访问权限的遗留表中记录的相应值更新每个记录的特定字段。这张表里有超过10k条记录。到目前为止,我正在顺序地遍历for循环中的每个记录,从旧表中获取相应的记录,比较字段值,必要时更新记录,并在其他表中添加相应的新记录。

但是,我希望通过异步处理所有记录来提高性能。为此,我考虑将每条记录信息作为一个单独的消息发送,因此需要如此多的消息。

EN

回答 1

Stack Overflow用户

发布于 2009-11-17 17:12:22

要配置OpenMQ和设置工件代理属性,请查看此博客帖子

但实际上,我不会建议增加imq.transaction.producer.maxNumMsgs属性,至少不要超过文档中推荐的值

生产者在单个事务中可以处理的最大消息数。建议值小于5000,以防止资源的耗尽。

如果您需要发送更多的消息,请考虑在几个事务中这样做。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1735842

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档