在我的项目中,我有一千个队列,我希望每个队列有一个消费者同步使用消息 .
我有一个任务执行程序,其中线程池大小为20,在数千个消息驱动通道适配器之间共享
当我启动我的应用程序时,我必须等待40分钟才能看到所有队列侦听器启动 . 我看不出问题出在哪里?
<int-jms:message-driven-channel-adapter
id="jmsAdapter"
acknowledge="transacted"
connection-factory="cachedConnectionFactory"
destination="destination"
channel="inboundChannel"
max-concurrent-consumers="1"
concurrent-consumers="1"
auto-startup="false"
task-executor="taskExecutor"/>
<bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<property name="corePoolSize" value="20"/>
<property name="maxPoolSize" value="20"/>
</bean>
谢谢
1 回答
您不能跨容器共享线程 - 每个消费者都需要一个专用线程 . 默认情况下,容器线程将在JMS客户端代码中阻塞等待消息的5秒钟 .