XmlBlaster Logo

REQUIREMENT

engine.qos.subscribe.id

XmlBlaster Logo


Type NEW
Priority LOW
Status CLOSED
Topic On subscribe you can force your own subscription id.
Des
cription

Every subscription returns a unique handle namely the subscription ID. This is used to refer to exact this subscription on updated messages or un unsubscribe requests.

This subscription ID is uniquely generated by xmlBlaster. On demand you can force xmlBlaster to use a subscription ID which is given by the subscriber. This subscription ID should be unique in the whole cluster environment, a proposed syntax is:

"__subId:client/[loginName]/session/[publicSessionId]-[your number or id]"
     

Example:

<qos> 
   <id>__subId:client/subscriber/session/2-13340998000</id>
   ...
</qos>
     

For java clients there is a prefix constant in org.xmlBlaster.util.def.Constants.java which you can use to build a unique subscription ID:

   public final static String SUBSCRIPTIONID_PREFIX = "__subId:";
     

If you have a fail safe client configured, using a positive session id (e.g. 'client/joe/session/1') and the subscription flag multiSubscribe is set to false, the java and C++ client library will automaticaly generate a subscriptionId which won't change on next restart of the client and which will be used by the server. The syntax is like:

__subId:[relativeSessionName]-[subscriptionUrl]
__subId:client/subscriber/session/2-exact:Hello

Benefit: If on client restart we are queueing the returned faked subscriptionId will match the later used one of the xmlBlaster server. We can easily use the subscriptionId as a key in a client code hashtable to dispatch update() messages.

Note: multiSubscribe==false allows max one subscription on a topic, even it has different mime query plugins (the latest wins).

Example
Java
      
import org.xmlBlaster.client.qos.SubscribeQos;

...

try {
   SubscribeQos sq = new SubscribeQos(glob);

   String subId = Constants.SUBSCRIPTIONID_PREFIX +
                  sessionName.getRelativeName(true) + "-" + myCounter;

   sq.setSubscriptionId(subId);

   String subId = con.subscribe("<key oid='NOTAM'/>, sq.toXml());
}
catch (Exception e) {
   ...
}
...
      
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.qos.SubscribeQos
See TEST org.xmlBlaster.test.qos.TestSubId

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

Back to overview