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













0















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:



  1. Allow the application to start and not be prevented by the message containers not being able to connect.

  2. After the application starts, start the message listeners.

  3. If the connection to one or any of the message listeners goes down, it should attempt to automatically reconnect.

  4. 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.

  5. Make all of this testable (as in, be able to write integration tests for this setup).

Current Setup:



  1. Spring Boot 1.5.6

  2. Apache ZooKeeper 3.4.6

  3. Apache ActiveMQ 5.7

  4. Wicket 7.7.0

Work done so far:



  1. Define a class that implements ApplicationListener<ApplicationReadyEvent>.

  2. Setting the autoStart property of the DefaultMessageListenerContainer to false and start each container in the onApplicationEvent in a separate thread.

Questions:



  1. 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.

  2. How do I accomplish goals 4 and 5?

Of course, any commments on whether I am on the right track would be helpful.










share|improve this question


























    0















    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:



    1. Allow the application to start and not be prevented by the message containers not being able to connect.

    2. After the application starts, start the message listeners.

    3. If the connection to one or any of the message listeners goes down, it should attempt to automatically reconnect.

    4. 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.

    5. Make all of this testable (as in, be able to write integration tests for this setup).

    Current Setup:



    1. Spring Boot 1.5.6

    2. Apache ZooKeeper 3.4.6

    3. Apache ActiveMQ 5.7

    4. Wicket 7.7.0

    Work done so far:



    1. Define a class that implements ApplicationListener<ApplicationReadyEvent>.

    2. Setting the autoStart property of the DefaultMessageListenerContainer to false and start each container in the onApplicationEvent in a separate thread.

    Questions:



    1. 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.

    2. How do I accomplish goals 4 and 5?

    Of course, any commments on whether I am on the right track would be helpful.










    share|improve this question
























      0












      0








      0








      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:



      1. Allow the application to start and not be prevented by the message containers not being able to connect.

      2. After the application starts, start the message listeners.

      3. If the connection to one or any of the message listeners goes down, it should attempt to automatically reconnect.

      4. 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.

      5. Make all of this testable (as in, be able to write integration tests for this setup).

      Current Setup:



      1. Spring Boot 1.5.6

      2. Apache ZooKeeper 3.4.6

      3. Apache ActiveMQ 5.7

      4. Wicket 7.7.0

      Work done so far:



      1. Define a class that implements ApplicationListener<ApplicationReadyEvent>.

      2. Setting the autoStart property of the DefaultMessageListenerContainer to false and start each container in the onApplicationEvent in a separate thread.

      Questions:



      1. 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.

      2. How do I accomplish goals 4 and 5?

      Of course, any commments on whether I am on the right track would be helpful.










      share|improve this question














      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:



      1. Allow the application to start and not be prevented by the message containers not being able to connect.

      2. After the application starts, start the message listeners.

      3. If the connection to one or any of the message listeners goes down, it should attempt to automatically reconnect.

      4. 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.

      5. Make all of this testable (as in, be able to write integration tests for this setup).

      Current Setup:



      1. Spring Boot 1.5.6

      2. Apache ZooKeeper 3.4.6

      3. Apache ActiveMQ 5.7

      4. Wicket 7.7.0

      Work done so far:



      1. Define a class that implements ApplicationListener<ApplicationReadyEvent>.

      2. Setting the autoStart property of the DefaultMessageListenerContainer to false and start each container in the onApplicationEvent in a separate thread.

      Questions:



      1. 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.

      2. 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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 25 at 16:26









      SwiftprotectorSwiftprotector

      84 bronze badges




      84 bronze badges




















          1 Answer
          1






          active

          oldest

          votes


















          0














          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.






          share|improve this answer























          • 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










          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
          );



          );













          draft saved

          draft discarded


















          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









          0














          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.






          share|improve this answer























          • 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















          0














          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.






          share|improve this answer























          • 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













          0












          0








          0







          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.






          share|improve this answer













          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.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          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

















          • 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






          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.



















          draft saved

          draft discarded
















































          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.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

          155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해