Deleted queue is not redefined, consumers stop to handle messages

梦想的初衷 提交于 2019-12-24 07:27:09

问题


I'm trying to solve following problem:

  1. I have 2 SimpleMessageListenerContainer defined in java conf.
  2. Each of them has it's own listener wrapped with adapter and they both use same CachingConnectionFactory(is it ok?). In addition each of them handles different queue(with constant name)
  3. I'm testing scenario when for whatever reason one of the queues is deleted.
  4. When I'm deleting it manually from web admin console the container tries to redefine this queue and fails(all retries fail). The exception is not really tells the reason of the failure.
  5. Eventually all the consumer threads of this queue are "restarted" however they wont consume any messages further. Even though somebody else will redefine this queue(e.g. producer)

so there are several questions:

  1. Can I fix redefinition of the queue somehow, or check why the redefinition fails? On fresh start the definition of queues works. Which brings me to next question
  2. Might be I can make heartbeat sender to use daemon thread somehow? It prevents jvm from exiting, so the restart isn't happening. It won't solve problem, but fresh jvm process succeeds to redefine queues. Restart will be caused by supervisor.

Meanwhile I'm getting situation when all consumers(under first container) for deleted queue are not really working, I'd expect that jvm will exit, however probably since I have second container which is ok(all consumers alive and queue exists), the jvm continues to live(might be when second container will be shutdown the heartbeat sender also will stop?)

any suggestions will be appreciated. If needed I'll post code snippets of java configuration.


回答1:


We just "fixed" this by adding a missing-queues-fatal attribute to the listener container.

See the pull request here.

We can't make schema changes in point releases so there's a couple of ways to configure it in 1.3.x; it has been added to the schema in 1.4.x and will be available in <rabbit:listener-container/>; you can see the 1.4.x Pull Request here.

1.3.5 should be available later this week, or next, but you can try 1.3.5.BUILD-SNAPSHOT now if you want.

When it is set to false (default true), the container will go into recovery mode, using the recovery-interval.

Documentation for the 1.3.5. snapshot is here.



来源:https://stackoverflow.com/questions/24373588/deleted-queue-is-not-redefined-consumers-stop-to-handle-messages

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!