Why is ActiveMQ consumer seen as connected for 10 seconds after killing it? -


i'm getting started , i've encountered problem activemq. i'm using local activemq without customizations, i've written simple publisher app

@component public class virtualtopicsender {      @autowired     private jmstemplate jmstemplate;      public void send() {         topic topic = new activemqtopic("virtualtopic.test-virtual-topic");         int = 0;          while(true) {             try {                 thread.sleep(1000);             } catch (interruptedexception e) {                 e.printstacktrace();             }             jmstemplate.convertandsend(topic, i++);         }     }  } 

and simple receiver

@component public class virtualtopicreceiver {      @jmslistener(destination="consumer.myconsumer0.virtualtopic.test-virtual-topic", containerfactory = "defaultmessagelistenercontainerfactory")     public void receivemessages(session session, string message) {         system.out.println(message);         try {             session.commit();         } catch (jmsexception e) {             e.printstacktrace();         }         try {             system.out.println(session.gettransacted());         } catch (jmsexception e) {             e.printstacktrace();         }     } } 

both springboot's.

what doing is:

  • starting receiver app in terminal
  • starting publisher app in terminal
  • seeing output receiver , killing ctrl+c
  • starting receiver again

now i'm missing output 10 seconds, netstat showing 10 seconds connection established

$ netstat -an | grep 575* | grep 61616   tcp    127.0.0.1:57809        127.0.0.1:61616        established   tcp    127.0.0.1:61616        127.0.0.1:57788        time_wait   tcp    127.0.0.1:61616        127.0.0.1:57789        time_wait   tcp    127.0.0.1:61616        127.0.0.1:57790        time_wait   tcp    127.0.0.1:61616        127.0.0.1:57791        time_wait   tcp    127.0.0.1:61616        127.0.0.1:57792        time_wait   tcp    127.0.0.1:61616        127.0.0.1:57793        time_wait   tcp    127.0.0.1:61616        127.0.0.1:57794        time_wait   tcp    127.0.0.1:61616        127.0.0.1:57795        time_wait   tcp    127.0.0.1:61616        127.0.0.1:57796        time_wait   tcp    127.0.0.1:61616        127.0.0.1:57797        time_wait   tcp    127.0.0.1:61616        127.0.0.1:57798        time_wait   tcp    127.0.0.1:61616        127.0.0.1:57799        time_wait   tcp    127.0.0.1:61616        127.0.0.1:57800        time_wait   tcp    127.0.0.1:61616        127.0.0.1:57801        time_wait   tcp    127.0.0.1:61616        127.0.0.1:57802        time_wait   tcp    127.0.0.1:61616        127.0.0.1:57803        time_wait   tcp    127.0.0.1:61616        127.0.0.1:57804        time_wait   tcp    127.0.0.1:61616        127.0.0.1:57805        time_wait   tcp    127.0.0.1:61616        127.0.0.1:57806        time_wait   tcp    127.0.0.1:61616        127.0.0.1:57808        time_wait   tcp    127.0.0.1:61616        127.0.0.1:57809        established 

do know how rid of 10 seconds delay? if i'll make application multiple instances of receivers can't risk losing messages 10 seconds before activemq switch instances, have no idea how fix that.

any appreciated.

okay, clear now. yesterday i've spent whole day reading documentation , trying understand behaviour, today decided make sure consumer dying when pressing ctrl+c - doesn't.

i've created simple rest endpoint in application receiver calling , after ctrl+c receiver still makes rest calls 10 seconds.

presented in question behaviour present in git bash.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -