Duncan Krebs
Duncan Krebs

Reputation: 3502

JMS/ActiveMQ Dynamic Creation/Removal of topics

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.

Upvotes: 1

Views: 3025

Answers (1)

Laures
Laures

Reputation: 5489

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

Upvotes: 6

Related Questions