JMS/ActiveMQ 动态创建/删除主题
我环顾四周,找不到我想要弄清楚的问题的好答案。
在我的系统中,我在运行时创建主题,其中运行时创建的主题有一个消费者和一个生产者。我想了解的是,在运行时创建主题的设计是否违背了JMS设计?
我这样做是因为它是向市场提供的数据源,每个主题都是具有特定股票订阅和每秒更新股票报价的可变速率的数据源。
我不明白的是,如果我采用这种方法,我希望能够在运行时创建的提要主题上不再有任何使用者时删除该主题。如何通过收到主题消费者计数通知来了解如何停止发布者并删除主题?
希望这不会损害我的声誉,我认为这是一个有效的问题。我查看了 activemq 中的虚拟主题,但这似乎不适合这个用例。
I have looked around and can't find a good answer to what I'm trying to figure out.
In my system, I am creating topics at runtime where there is a single consumer and single producer for the topics being created at runtime. What I would like input on is, does the design of creating topics at runtime go against the JMS design?
I'm doing this because its a data feed to the market and each topic is a datafeed with specific stock subscriptions and variable rate of how many quotes to update on a stock per second.
What I can't figure out is, if I go this approach I would like to be able to delete the topic when there are no longer any consumers on the feed topic that was created in runtime. How I can figure out how to stop the publisher and delete the topic by being notified on the consumer count of a topic?
Hopefully this won't diss my reputation I think its a valid question. I looked at virtual topics in activemq but that does not seem to fit this use case.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将 activemq 配置为垃圾收集没有消费者的空目标
http://activemq.apache.org/ delete-inactive-destinations.html
此外,还有多种(或多或少简单)的手动方法:
http://activemq.apache.org/how-do-i-purge -a-queue.html
ps:请换行
You can configure activemq to garbage collect empty destinations without consumers
http://activemq.apache.org/delete-inactive-destinations.html
in addition there are multiple (more or less easy) ways to do it by hand:
http://activemq.apache.org/how-do-i-purge-a-queue.html
ps: line-breaks please