Managing JMS Message Containers on Application Startup and ShutdownHow to resolve Error listenerStart when deploying web-app in Tomcat 5.5?Spring JmsTemplate and Apache ActiveMQ, why so many connections?Unable to shutdown embedded activeMQ service using the built in BrokerService.stop callGracefully stop DefaultMessageListenerContainer having a receiveTimeout = -1Spring Container hangs if ActiveMQ is not startedTrying to stop a message-driven-channel-adapter but droppping a messageDefaultMessageListenerContainer and ActiveMQ thread managementShutdown Spring boot application after zookeeper connection is lostHow to shutdown ActiveMQ session thread gracefully on tomcatHow to properly stop camelContext from being killed in a standalone application
Is it OK to say "The situation is pregnant with a crisis"?
Why didn't Caesar move against Sextus Pompey immediately after Munda?
Reusable spacecraft: why still have fairings detach, instead of open/close?
Move up, right, left and down functions
Why didn't Avengers simply jump 5 years back?
How does mmorpg store data?
How do I present a future free of gender stereotypes without being jarring or overpowering the narrative?
What is this fluorinated organic substance?
Chandra exiles a card, I play it, it gets exiled again
Rear derailleur got caught in the spokes, what could be a root cause
What verb goes with "coup"?
Can a quantum computer run classical algorithms?
Apollo Mission Control Room 2, how do these decimal number displays work?
Does Flashpoint ever indicate directly that it takes place in Toronto?
Any Tips On Writing Extended Recollection In A Novel
Fitting large table to single page
How to count the number of bytes in a file, grouping the same bytes?
Why do movie directors use brown tint on Mexico cities?
Is it theoretically possible to hack printer using scanner tray?
What is my external HDD doing?
Two palindromes are not enough
Is it possible to alias a column based on the result of a select+where?
What happens if a caster is surprised while casting a spell with a long casting time?
What could a Medieval society do with excess animal blood?
Managing JMS Message Containers on Application Startup and Shutdown
How to resolve Error listenerStart when deploying web-app in Tomcat 5.5?Spring JmsTemplate and Apache ActiveMQ, why so many connections?Unable to shutdown embedded activeMQ service using the built in BrokerService.stop callGracefully stop DefaultMessageListenerContainer having a receiveTimeout = -1Spring Container hangs if ActiveMQ is not startedTrying to stop a message-driven-channel-adapter but droppping a messageDefaultMessageListenerContainer and ActiveMQ thread managementShutdown Spring boot application after zookeeper connection is lostHow to shutdown ActiveMQ session thread gracefully on tomcatHow to properly stop camelContext from being killed in a standalone application
Currently, we have four JMS listener containers that are started during the application start. They all connect through Apache ZooKeeper and are manually started. This becomes problematic when a connection to ZooKeeper cannot be established. The (Wicket) application cannot start, even though it is not necessary for the JMS listeners be active to use the application. They simply need to listen to messages in the background, save them and a cron job will process them in batches.
Goals:
- Allow the application to start and not be prevented by the message containers not being able to connect.
- After the application starts, start the message listeners.
- If the connection to one or any of the message listeners goes down, it should attempt to automatically reconnect.
- On application shutdown (such as the Tomcat being shutdown), the application should stop the message listeners and the cron job that processes the saved messages.
- Make all of this testable (as in, be able to write integration tests for this setup).
Current Setup:
- Spring Boot 1.5.6
- Apache ZooKeeper 3.4.6
- Apache ActiveMQ 5.7
- Wicket 7.7.0
Work done so far:
- Define a class that implements
ApplicationListener<ApplicationReadyEvent>. - Setting the
autoStartproperty of theDefaultMessageListenerContainerto false and start each container in theonApplicationEventin a separate thread.
Questions:
- Is it necessary to start each message container in its own thread? This seems to be overkill, but the way the "start" process works is that the DefaultMessageListenerContainer is built for that listener and then it is started. There is a UI component that a user can use to start/stop the message listeners if need be, and if these are started sequentially in one thread, then the latter three message containers could be null if the first one has yet to connect on startup.
- How do I accomplish goals 4 and 5?
Of course, any commments on whether I am on the right track would be helpful.
spring activemq wicket apache-zookeeper
add a comment |
Currently, we have four JMS listener containers that are started during the application start. They all connect through Apache ZooKeeper and are manually started. This becomes problematic when a connection to ZooKeeper cannot be established. The (Wicket) application cannot start, even though it is not necessary for the JMS listeners be active to use the application. They simply need to listen to messages in the background, save them and a cron job will process them in batches.
Goals:
- Allow the application to start and not be prevented by the message containers not being able to connect.
- After the application starts, start the message listeners.
- If the connection to one or any of the message listeners goes down, it should attempt to automatically reconnect.
- On application shutdown (such as the Tomcat being shutdown), the application should stop the message listeners and the cron job that processes the saved messages.
- Make all of this testable (as in, be able to write integration tests for this setup).
Current Setup:
- Spring Boot 1.5.6
- Apache ZooKeeper 3.4.6
- Apache ActiveMQ 5.7
- Wicket 7.7.0
Work done so far:
- Define a class that implements
ApplicationListener<ApplicationReadyEvent>. - Setting the
autoStartproperty of theDefaultMessageListenerContainerto false and start each container in theonApplicationEventin a separate thread.
Questions:
- Is it necessary to start each message container in its own thread? This seems to be overkill, but the way the "start" process works is that the DefaultMessageListenerContainer is built for that listener and then it is started. There is a UI component that a user can use to start/stop the message listeners if need be, and if these are started sequentially in one thread, then the latter three message containers could be null if the first one has yet to connect on startup.
- How do I accomplish goals 4 and 5?
Of course, any commments on whether I am on the right track would be helpful.
spring activemq wicket apache-zookeeper
add a comment |
Currently, we have four JMS listener containers that are started during the application start. They all connect through Apache ZooKeeper and are manually started. This becomes problematic when a connection to ZooKeeper cannot be established. The (Wicket) application cannot start, even though it is not necessary for the JMS listeners be active to use the application. They simply need to listen to messages in the background, save them and a cron job will process them in batches.
Goals:
- Allow the application to start and not be prevented by the message containers not being able to connect.
- After the application starts, start the message listeners.
- If the connection to one or any of the message listeners goes down, it should attempt to automatically reconnect.
- On application shutdown (such as the Tomcat being shutdown), the application should stop the message listeners and the cron job that processes the saved messages.
- Make all of this testable (as in, be able to write integration tests for this setup).
Current Setup:
- Spring Boot 1.5.6
- Apache ZooKeeper 3.4.6
- Apache ActiveMQ 5.7
- Wicket 7.7.0
Work done so far:
- Define a class that implements
ApplicationListener<ApplicationReadyEvent>. - Setting the
autoStartproperty of theDefaultMessageListenerContainerto false and start each container in theonApplicationEventin a separate thread.
Questions:
- Is it necessary to start each message container in its own thread? This seems to be overkill, but the way the "start" process works is that the DefaultMessageListenerContainer is built for that listener and then it is started. There is a UI component that a user can use to start/stop the message listeners if need be, and if these are started sequentially in one thread, then the latter three message containers could be null if the first one has yet to connect on startup.
- How do I accomplish goals 4 and 5?
Of course, any commments on whether I am on the right track would be helpful.
spring activemq wicket apache-zookeeper
Currently, we have four JMS listener containers that are started during the application start. They all connect through Apache ZooKeeper and are manually started. This becomes problematic when a connection to ZooKeeper cannot be established. The (Wicket) application cannot start, even though it is not necessary for the JMS listeners be active to use the application. They simply need to listen to messages in the background, save them and a cron job will process them in batches.
Goals:
- Allow the application to start and not be prevented by the message containers not being able to connect.
- After the application starts, start the message listeners.
- If the connection to one or any of the message listeners goes down, it should attempt to automatically reconnect.
- On application shutdown (such as the Tomcat being shutdown), the application should stop the message listeners and the cron job that processes the saved messages.
- Make all of this testable (as in, be able to write integration tests for this setup).
Current Setup:
- Spring Boot 1.5.6
- Apache ZooKeeper 3.4.6
- Apache ActiveMQ 5.7
- Wicket 7.7.0
Work done so far:
- Define a class that implements
ApplicationListener<ApplicationReadyEvent>. - Setting the
autoStartproperty of theDefaultMessageListenerContainerto false and start each container in theonApplicationEventin a separate thread.
Questions:
- Is it necessary to start each message container in its own thread? This seems to be overkill, but the way the "start" process works is that the DefaultMessageListenerContainer is built for that listener and then it is started. There is a UI component that a user can use to start/stop the message listeners if need be, and if these are started sequentially in one thread, then the latter three message containers could be null if the first one has yet to connect on startup.
- How do I accomplish goals 4 and 5?
Of course, any commments on whether I am on the right track would be helpful.
spring activemq wicket apache-zookeeper
spring activemq wicket apache-zookeeper
asked Mar 25 at 16:26
SwiftprotectorSwiftprotector
84 bronze badges
84 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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.
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). I haven't used those in several years, so I cannot help you more.
Hello @martin-g, thank you for taking a look at my question. I still have a few open questions. From what it appears, if I do not start each of them in a separate thread, then if one cannot connect, then the subsequent containers will wait until the first connects. But how does one control these threads? When I shutdown the application now, the threads stay open after the Spring context has been destroyed, so point 4 has yet to be fulfilled. Point 5 is where I am still quite unsure.
– Swiftprotector
Mar 28 at 9:43
It depends how you have started them. I prefer using ExecutorService. You can shut it down in Servlet Filter#destroy(), Wicket Application#onDestroy(), Spring onEvent(ApplicationStopped), etc.
– martin-g
Mar 28 at 13:15
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55342330%2fmanaging-jms-message-containers-on-application-startup-and-shutdown%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
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). I haven't used those in several years, so I cannot help you more.
Hello @martin-g, thank you for taking a look at my question. I still have a few open questions. From what it appears, if I do not start each of them in a separate thread, then if one cannot connect, then the subsequent containers will wait until the first connects. But how does one control these threads? When I shutdown the application now, the threads stay open after the Spring context has been destroyed, so point 4 has yet to be fulfilled. Point 5 is where I am still quite unsure.
– Swiftprotector
Mar 28 at 9:43
It depends how you have started them. I prefer using ExecutorService. You can shut it down in Servlet Filter#destroy(), Wicket Application#onDestroy(), Spring onEvent(ApplicationStopped), etc.
– martin-g
Mar 28 at 13:15
add a comment |
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.
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). I haven't used those in several years, so I cannot help you more.
Hello @martin-g, thank you for taking a look at my question. I still have a few open questions. From what it appears, if I do not start each of them in a separate thread, then if one cannot connect, then the subsequent containers will wait until the first connects. But how does one control these threads? When I shutdown the application now, the threads stay open after the Spring context has been destroyed, so point 4 has yet to be fulfilled. Point 5 is where I am still quite unsure.
– Swiftprotector
Mar 28 at 9:43
It depends how you have started them. I prefer using ExecutorService. You can shut it down in Servlet Filter#destroy(), Wicket Application#onDestroy(), Spring onEvent(ApplicationStopped), etc.
– martin-g
Mar 28 at 13:15
add a comment |
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.
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). I haven't used those in several years, so I cannot help you more.
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.
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). I haven't used those in several years, so I cannot help you more.
answered Mar 26 at 7:57
martin-gmartin-g
12.6k19 silver badges26 bronze badges
12.6k19 silver badges26 bronze badges
Hello @martin-g, thank you for taking a look at my question. I still have a few open questions. From what it appears, if I do not start each of them in a separate thread, then if one cannot connect, then the subsequent containers will wait until the first connects. But how does one control these threads? When I shutdown the application now, the threads stay open after the Spring context has been destroyed, so point 4 has yet to be fulfilled. Point 5 is where I am still quite unsure.
– Swiftprotector
Mar 28 at 9:43
It depends how you have started them. I prefer using ExecutorService. You can shut it down in Servlet Filter#destroy(), Wicket Application#onDestroy(), Spring onEvent(ApplicationStopped), etc.
– martin-g
Mar 28 at 13:15
add a comment |
Hello @martin-g, thank you for taking a look at my question. I still have a few open questions. From what it appears, if I do not start each of them in a separate thread, then if one cannot connect, then the subsequent containers will wait until the first connects. But how does one control these threads? When I shutdown the application now, the threads stay open after the Spring context has been destroyed, so point 4 has yet to be fulfilled. Point 5 is where I am still quite unsure.
– Swiftprotector
Mar 28 at 9:43
It depends how you have started them. I prefer using ExecutorService. You can shut it down in Servlet Filter#destroy(), Wicket Application#onDestroy(), Spring onEvent(ApplicationStopped), etc.
– martin-g
Mar 28 at 13:15
Hello @martin-g, thank you for taking a look at my question. I still have a few open questions. From what it appears, if I do not start each of them in a separate thread, then if one cannot connect, then the subsequent containers will wait until the first connects. But how does one control these threads? When I shutdown the application now, the threads stay open after the Spring context has been destroyed, so point 4 has yet to be fulfilled. Point 5 is where I am still quite unsure.
– Swiftprotector
Mar 28 at 9:43
Hello @martin-g, thank you for taking a look at my question. I still have a few open questions. From what it appears, if I do not start each of them in a separate thread, then if one cannot connect, then the subsequent containers will wait until the first connects. But how does one control these threads? When I shutdown the application now, the threads stay open after the Spring context has been destroyed, so point 4 has yet to be fulfilled. Point 5 is where I am still quite unsure.
– Swiftprotector
Mar 28 at 9:43
It depends how you have started them. I prefer using ExecutorService. You can shut it down in Servlet Filter#destroy(), Wicket Application#onDestroy(), Spring onEvent(ApplicationStopped), etc.
– martin-g
Mar 28 at 13:15
It depends how you have started them. I prefer using ExecutorService. You can shut it down in Servlet Filter#destroy(), Wicket Application#onDestroy(), Spring onEvent(ApplicationStopped), etc.
– martin-g
Mar 28 at 13:15
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55342330%2fmanaging-jms-message-containers-on-application-startup-and-shutdown%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown