You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-user@ws.apache.org by Daniel Jemiolo <da...@us.ibm.com> on 2007/01/02 17:08:20 UTC

Re: destroy notification topics

1. The list of topics exists independent of how many subscribers there 
are. I would make an analogy to radio stations: whether a station has zero 
or a thousand listeners, it still exists. If there are zero listeners, the 
station still exists and will be available should someone tune the dial to 
it. Similarly, topics are part of a resource's interface and do not 
increase or decrease based on subscribers.

2. No - the WSN spec only allows you to pause subscriptions, not topics. 
In order to pause all subscriptions that sent out messages on a given 
topic, you'd have to iterate through all of the subcriptions, find the 
ones that were topic-oriented, and pause them.

If you wanted to do this as a server-side operation, the easiest way might 
be to extend SimpleNotificationProducer and plug the new class in as your 
WSN implementation (in muse.xml). Something like this:


class PausableNotificationProducer extends SimpleNotificationProducer
{
        public void pause(QName topicName)
        {
                Iterator i = getSubscriptions().iterator();

                //
                // for each subscription we currently have...
                //
                while (i.hasNext())
                {
                        //
                        // use the WSN SubscriptionManager capability to 
                        // find the subscription's filter type
                        //
                        WsResource subResource = (Subscription)i.next();
                        SubscriptionManager subMgr = 
subResource.getCapability(WsnConstants.SUBSCRIPTION_MGR_URI);
                        Filter filter = sub.getFilter();

                        //
                        // if it uses topics, compare the topic names
                        //
                        if (filter instanceof TopicFilter)
                        {
                                TopicFilter topicFilter = 
(TopicFilter)filter;
                                QName subTopic = topicFilter.getTopic();

                                //
                                // we have a match - shut it off
                                //
                                if (subTopic.equals(topicName))
                                        subMgr.pauseSubscription();
                        }
                }
        }
}



"Vinh Nguyen \(vinguye2\)" <vi...@cisco.com> wrote on 12/19/2006 
03:42:44 PM:

> A subscribe request must specify zero or one topic.  So suppose several
> clients are subscribed to the same topic.
> 
> 1) If all clients unsubscribe, does Muse still hold on to the topic?  If
> so, how do we prevent Muse from building up a list of unused topics, if
> it does keep such a list?
> 
> 2) Is there a way to destroy/pause a topic, and effectively stop its
> corresponding notifications from being sent out, without killing the
> subscriptions?  Then be able to resume the topic and notifications at a
> later time?
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org