|
REQUIREMENT interface.get |
| Type | NEW |
| Priority | HIGH |
| Status | CLOSED |
| Topic | Synchronous message access with the get() method | |||||||||||||||
|
Des cription |
The get() method allows to retrieve messages from xmlBlaster. You can access exactly one message by passing its oid, or a selection of messages by passing an XPATH query. Method detail (CORBA IDL notation):
typedef string XmlType;
typedef sequence<MessageUnit> MessageUnitArr;
MessageUnitArr get(in XmlType xmlKey, in XmlType xmlQos)
raises(XmlBlasterException);
Here is an overview of all available get QoS:
<qos>
<!-- Don't return the content data of the message (notify only) -->
<content>false</content>
<!-- Filters messages as implemented in the specified plugin -->
<!-- Here we use the regex filter and only want contents starting with the letter 'H' -->
<filter type='GnuRegexFilter' version='1.0'>
^H.*$
</filter>
<!-- Default is to deliver the current entry (numEntries='1'), '-1' deliver all (default: 1) -->
<!-- newestFirst let you change the delivery order, it defaults to true -->
<!-- The higher priority messages are always delivered first. -->
<!-- In one priority the newest message is delivered first with 'true', setting 'false' -->
<!-- reverts the delivery sequence in this priority. -->
<history numEntries='20' newestFirst='true'/>
<!-- optional, see requirement engine.qos.queryspec.QueueQuery -->
<querySpec type='QueueQuery'><![CDATA[
maxEntries=3&maxSize=-1&consumable=false&waitingDelay=0]]>
</querySpec>
</qos>
A special note how to use get() in cluster environments:If you invoke get() on a cluster slave node, the request is only forwarded to a master node if the key matches the configured master selection. |
|||||||||||||||
|
Example XML |
Here is an example of an exact query:
And a return value:
|
|||||||||||||||
|
Example XML |
Here is an example of an XPATH query:
|
|||||||||||||||
|
Example XML |
get() in a cluster environment belonging to domain RUGBY_NEWS
|
|||||||||||||||
|
Example XmlRpc |
This is the XmlRpc server interface variant:
public Vector get(String sessionId, String xmlKey_literal, String qos_literal)
throws XmlBlasterException
|
|||||||||||||||
|
Example RMI |
This is the RMI server interface variant:
public MsgUnit[] get(String sessionId, String xmlKey_literal, String qos_literal)
throws RemoteException, XmlBlasterException
|
|||||||||||||||
|
Example Java |
A typical Java client code for an EXACT subscription:
import org.xmlBlaster.client.key.GetKey;
import org.xmlBlaster.client.qos.GetQos;
import org.xmlBlaster.util.MsgUnit;
...
GetKey sk = new GetKey(glob, "MyOid");
GetQos sq = new GetQos(glob);
MsgUnit[] msgs = con.get(sk.toXml(), sq.toXml());
System.out.println("Success, retrieved " + msgs.length + " messages.");
See xmlBlaster/demo/HelloWorld*.java for more examples. |
|||||||||||||||
|
Example Java |
A typical Java client code for an XPATH subscription:
GetKey sk = new GetKey(glob, "/xmlBlaster/key[@oid='radar.track']",
Constants.XPATH);
GetQos sq = new GetQos(glob);
MsgUnit[] msgs = con.get(sk.toXml(), sq.toXml());
The same in raw XML notation:
MsgUnit[] msgs = con.get("<key oid=\"/xmlBlaster/key[@oid='radar.track']\" />", "<qos/>");
|
|||||||||||||||
|
Example Java |
A typical Java client code for retrieval in a cluster environment which uses selection of master nodes with message domains:
GetKey sk = new GetKey(glob, "MyMessageOid");
sk.setDomain("RUGBY_NEWS"); // Subscription is forwarded from slaves to master
// without setting the domain the get would just be handled by the slave connected to
MsgUnit[] msgs = con.get(sk.toXml(), null);
|
|||||||||||||||
| 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. |
|||||||||||||||
| See REQ | interface | |||||||||||||||
| See | ../../demo/javaclients/HelloWorldGet.java.html | |||||||||||||||
| See API | org.xmlBlaster.client.qos.GetQos | |||||||||||||||
| See API | org.xmlBlaster.client.I_XmlBlasterAccess | |||||||||||||||
| See API | org.xmlBlaster.util.MsgUnit | |||||||||||||||
| See API | org.xmlBlaster.protocol.xmlrpc.XmlBlasterImpl | |||||||||||||||
| See API | org.xmlBlaster.protocol.rmi.XmlBlasterImpl | |||||||||||||||
| See REQ | Query history/callback/subject queue (sync) |
This page is generated from the requirement XML file xmlBlaster/doc/requirements/interface.get.xml