On 7/9/07, happyAMQ <[EMAIL PROTECTED]> wrote:

This sounds ideal.  Can you point me to some docs on how to write a plugin?

Here's some documentation...
http://activemq.apache.org/interceptors.html
http://activemq.apache.org/developing-plugins.html

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?
http://activemq.apache.org/contributing.html


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...

http://activemq.apache.org/maven/activemq-core/apidocs/org/apache/activemq/broker/Broker.html

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
consumers).

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

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
        removeDestination(d);
    }

    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
-------
http://macstrac.blogspot.com/



--
View this message in context: 
http://www.nabble.com/Temporary-destinations-with-given-destination-name-tf4037658s2354.html#a11511275
Sent from the ActiveMQ - User mailing list archive at Nabble.com.




--
James
-------
http://macstrac.blogspot.com/

Reply via email to