【问题标题】:MDB concurrent instances not startingMDB 并发实例未启动
【发布时间】:2016-03-26 01:32:54
【问题描述】:

我有一个要求,我需要 40 个线程来执行某个任务(合并),大约 20 个线程来执行另一个任务(持久性)。合并比持久化花费大约 5 倍的时间。 我正在使用消息驱动的 bean 来实现这种并发性。

我使用以下配置创建了一个 MDB RecordMerger

@MessageDriven(activationConfig = { 
    @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
    @ActivationConfigProperty(propertyName = "destination", propertyValue = "testing/RecordMerger"),
    @ActivationConfigProperty(propertyName = "maxSessions", propertyValue = "40")
})

我为坚持做了类似的事情

@MessageDriven(activationConfig = { 
    @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
    @ActivationConfigProperty(propertyName = "destination", propertyValue = "testing/RecordPersistor"),
    @ActivationConfigProperty(propertyName = "maxSessions", propertyValue = "20")
})

我在tomee.xml中的配置如下

 <Container id="MyJmsMdbContainer" ctype="MESSAGE">
    ResourceAdapter = MyJmsResourceAdapter
    InstanceLimit = 40
</Container>

记录合并队列的生产速度非常快,因此记录合并队列中总是有新元素。记录合并队列将数据放入Record Persistence队列中。

我面临的问题是,当记录合并配置为使用 40 个线程时,我的 tomee 服务器没有实例化记录持久性 MDB,这导致记录堆积在该队列中。如果我将记录合并的 maxSession 属性减少到 20,则两个 MDB 都开始实例化。

谁能指导我我需要做什么来确保两个 MDB 都在运行并且记录合并有 40 个线程。

【问题讨论】:

    标签: concurrency activemq apache-tomee message-driven-bean tomee-7


    【解决方案1】:

    您可能还需要在资源适配器定义 (tomee.xml) 中设置 threadPoolSize=40(默认为 30)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-15
      • 1970-01-01
      • 2019-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-22
      • 1970-01-01
      相关资源
      最近更新 更多