[英]Managing JMS Message Containers on Application Startup and Shutdown
Currently, we have four JMS listener containers that are started during the application start. 目前,我们有四个在应用程序启动期间启动的JMS侦听器容器。 They all connect through Apache ZooKeeper and are manually started. 它们都通过Apache ZooKeeper连接并手动启动。 This becomes problematic when a connection to ZooKeeper cannot be established. 当无法建立与ZooKeeper的连接时,这会成为问题。 The (Wicket) application cannot start, even though it is not necessary for the JMS listeners be active to use the application. (Wicket)应用程序无法启动,即使JMS侦听器不必处于活动状态以使用该应用程序。 They simply need to listen to messages in the background, save them and a cron job will process them in batches. 他们只需要在后台监听消息,保存它们,而cron作业将分批处理它们。
Goals : 目标 :
Current Setup : 当前设置 :
Work done so far : 迄今为止完成的工作 :
ApplicationListener<ApplicationReadyEvent>
. 定义一个实现ApplicationListener<ApplicationReadyEvent>
。 autoStart
property of the DefaultMessageListenerContainer
to false and start each container in the onApplicationEvent
in a separate thread. 设置autoStart
的财产DefaultMessageListenerContainer
为假,并开始在每个容器onApplicationEvent
在一个单独的线程。 Questions : 问题 :
Of course, any commments on whether I am on the right track would be helpful. 当然,关于我是否在正确的轨道上的任何提交都会有所帮助。
If you do not start them in a custom thread then the whole application cannot be fully started. 如果您不在自定义线程中启动它们,则无法完全启动整个应用程序。 It is not just Wicket, but the Servlet container won't change the application state from STARTING to STARTED due to the blocking request to ZooKeeper. 它不仅仅是Wicket,而且由于对ZooKeeper的阻塞请求,Servlet容器不会将应用程序状态从STARTING更改为STARTED。
Another option is to use a non-blocking request to ZooKeeper but this is done by the JMS client (ActiveMQ), so you need to check whether this is supported in their docs (both ActiveMQ and ZooKeeper). 另一种选择是对ZooKeeper使用非阻塞请求,但这是由JMS客户端(ActiveMQ)完成的,因此您需要检查它们的文档(ActiveMQ和ZooKeeper)是否支持它。 I haven't used those in several years, so I cannot help you more. 我好几年没用过了,所以我帮不了你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.