XmlBlaster Logo



XmlBlaster Logo

Type NEW
Priority HIGH
Topic XmlBlaster has a plugin which is used to query message entries on arbitrary queues

As an implementation of the I_Query interface the following plugin is invoked when doing a query to a queue. The query can be done as a synchronous get or in future via a subscription. More specifically it is done with an administrative GET so it can be invoked either via an administrative message or via telnet, snmp or jmx.
For administrative messages the command itself is put into the oid of the key of the message and the attributes of the query are passed inside the query qos which in the case of a GET would be the GetQos.
Attributes can be:

maxEntries1 an integer. The maximum number of entries to retrieve yes
maxBytes-1 a long. The total size of all returned messages together must not exceed this value. This is not implemented yet since the size of the entries in the queue is not guaranteed to be related to the size of the MsgUnits no
consumablefalse a boolean (expressed with the string 'true' or 'false'. If true the entries returned are deleted from the queue. yes
waitingDelay0 a long. The time to wait until return. If you choose a negative value it will block until either the maxEntries or the maxSize has been reached. If the value is '0' (i.e. zero) it will not wait and will correspond to a non-blocking get. If the value is positive it will block until the specified amount in milliseconds has elapsed or when the maxEntries or the maxSize has been reached (whichever comes first). yes

When an invocation on this plugin is done, it will look for the querySpec tag containing the type='QueueQuery' in the qos. If none is found, default values are taken. If they are found, the content of the query tag is parsed. The syntax on how to pass these attributes is the same as for an http get method, i.e. a '&' separated list of pairs of key/value. Each key is separated from its value by a '=' token.

When used from such administrative gateways which don't have the possibility to specify a key and a qos, for example via telnet, the qos is passed at the end of the command with a key xmlBlaster.qos.

Following queue types are supported:

  1. session queue: Each client session with a callback server has such a callback queue, for example
    get client/joe/session/1/?callbackQueueEntries
  2. subject queue: Each client has a subject queue to hold PtP messages, for example
    get client/joe/?subjectQueueEntries
  3. history queue: Each topic has a history queue, for example
    get topic/hello/?historyQueueEntries

These is an example key and QoS of a get() invoked from within the XmlScript demo, copy the script below into a file test.xml and invoke java javaclients.script.XmlScript -requestFile test.xml:

    <connect />
      <key oid='__cmd:client/joe/session/1/?callbackQueueEntries' queryType='EXACT'>
        <querySpec type='QueueQuery'><![CDATA[
    <disconnect />
This example is invoked from a ordinary telnet client (telnet localhost 2702):
GET client/subscribe/session/1/?callbackQueueEntries="maxEntries=2&maxSize=-1&consumable=true"

  <subscribe id='__subId:1142197847757000000'/>
  <expiration lifeTime='-1' forceDestroy='false'/>
  <rcvTimestamp nanos='1142197883173000000'/>
 <key oid='Hello' contentMime='text/xml' contentMimeExtended='1.0'/>
 <content type='String'>Hi-16</content>

  <subscribe id='__subId:1142197847757000000'/>
  <expiration lifeTime='-1' forceDestroy='false'/>
  <rcvTimestamp nanos='1142197883209000000'/>
 <key oid='Hello' contentMime='text/xml' contentMimeExtended='1.0'/>
 <content type='String'>Hi-17</content>

This example consumes 2 messages from the history queue of the topic Hello, if there are no messages we return immediately:

GET topic/Hello/?historyQueueEntries="maxEntries=2&maxSize=-1&consumable=true&waitingDelay=0"


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.engine.query.I_Query
See API org.xmlBlaster.engine.query.plugins.QueueQueryPlugin
See API org.xmlBlaster.util.plugin.I_Plugin
See REQ mime.plugin.accessfilter
See REQ admin
See REQ admin.commands
See REQ admin.messages
See REQ engine.qos.queryspec
See REQ client.script
See A scripting example
See TEST org.xmlBlaster.test.admin.TestAdminGet

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

Back to overview