XmlBlaster Logo

REQUIREMENT

engine.qos.subscribe.multiSubscribe

XmlBlaster Logo


Type NEW
Priority LOW
Status CLOSED
Topic On multiple subscription on the same topic a client can specify to receive this message only once.
Des
cription

If you subscribe with the same client (the same login session) multiple times to the same message you will receive this message multiple times, one update for each subscription.

Sometimes you may want to ignore multiple subscriptions. If you set on subscribe

<qos> 
   ...
   <multiSubscribe>false</multiSubscribe>  
</qos>
     

multiSubscribe to false the new subscription with identical topic or XPath specification will be ignored. In this case the same subscription ID which you got on initial subscribe is returned.

If you subscribe with an XPath query, only the query string will be checked to be identical. In the case that an XPath subscription (with different query syntax) hits an already subscribed topic you will receive the topic twice.

The returned subscription ID is identical for identical subscribes, additionally the returned status is set to "WARNING". Note that you have to call unSubscribe() only once if all subscribes used multiSubscribe=false.

If your SubscribeQos contains access filter rules (see requirement mime.plugin.accessfilter) and you have set multiSubscribe to false the existing subscription will be re-configured with the new AccessFilter rule.
Note: If you have set multiple identical subscription with multiSubscribe=true and later one with multiSubscribe=false this will reconfigure all existing identical subscriptions.

Example
Java
      
import org.xmlBlaster.client.I_XmlBlasterAccess;
import org.xmlBlaster.client.qos.ConnectQos;
import org.xmlBlaster.client.qos.SubscribeQos;
import org.xmlBlaster.client.qos.SubscribeReturnQos;
...

try {
   con = glob.getXmlBlasterAccess();
   ConnectQos qos = new ConnectQos(glob);
   con.connect(qos, this);

   SubscribeQos subQos = new SubscribeQos(glob);

   subQos.setMultiSubscribe(false);

   SubscribeReturnQos subId1 = con.subscribe("<key oid='radar-track'/>", subQos.toXml());

   SubscribeReturnQos subId2 = con.subscribe("<key oid='radar-track'/>", subQos.toXml());

   System.out.println("Got subscribe receipt: state=" + subId1.getState() +
                      " subscriptionId=" + subId1.getSubscriptionId());

   // only one message is updated if the topic 'radar-track' is published
   // subId1 and subId2 are identical, one unSubscribe is enough:

   con.unSubscribe("<key oid='" + subId1 + "'/>", null);
}
catch (Exception e) {
      log.error(ME, "Login failed: " + e.toString());
}
...
      
   
Configure

NOTE: Configuration parameters are specified on command line (-someValue 17) or in the xmlBlaster.properties file (someValue=17). See requirement "util.property" for details.
Columns named Impl tells you if the feature is implemented.
Columns named Hot tells you if the configuration is changeable in hot operation.

See API org.xmlBlaster.client.I_XmlBlasterAccess
See TEST org.xmlBlaster.test.qos.TestSubMultiSubscribe

This page is generated from the requirement XML file xmlBlaster/doc/requirements/engine.qos.subscribe.multiSubscribe.xml

Back to overview