JMS/ActiveMQ 动态创建/删除主题

发布于 2024-12-27 17:04:13 字数 325 浏览 0 评论 0原文

我环顾四周,找不到我想要弄清楚的问题的好答案。

在我的系统中,我在运行时创建主题,其中运行时创建的主题有一个消费者和一个生产者。我想了解的是,在运行时创建主题的设计是否违背了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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

高冷爸爸 2025-01-03 17:04:13

您可以将 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文