activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <>
Subject Re: Temporary destinations with given destination name
Date Tue, 10 Jul 2007 07:56:30 GMT
On 7/9/07, happyAMQ <> wrote:
> This sounds ideal.  Can you point me to some docs on how to write a plugin?

Here's some documentation...

its probably easiest to look at the code for some existing plugins to
get the idea.

I think this will be a useful addition; do you fancy contributing your
plugin to the project?

> Would I be using the same JMX method to delete the destinations in this
> plugin?

You could do; though a BrokerPlugin has access to the real broker...

so you can tinker directly with whatever you like.

Note that its the getDestinationMap() you'll be using on the base
Region interface to introspect the available Destination objects, to
get the DestinatioStatistics (to check for empty queues with no

You probably wanna keep a cache in your plugin; for each destination
cache the enqueue counts for empty destinations with no consumers. In

onTimer() {
for (Destination d) {
  if (d.destinationStats.messages == 0 && d.destinationStats.consumers == 0) {
     enqueueCount = cache.get(d);
     if (enqueueCount != null && enqueueCount ==
d.destinationStats.enqueueCount) {
         // no activity within a timeout period so lets delete

     if (cache.contains(d)) {

So that each time a timer fires, you can look for all empty
destinations with no consumers; if you've cache; so that when each

> Thanks!
> Jason.
> -->  Another option is to write a little broker plugin to eagerly delete
> any broker-side destinations which are not being used by any clients
> within some time period. e.g. if no client uses a particular
> destination within say 10 seconds (and the destination is empty), then
> just zap it.
> --
> James
> -------
> --
> View this message in context:
> Sent from the ActiveMQ - User mailing list archive at


View raw message