1 /*------------------------------------------------------------------------------
  2 Name:      UpdateQos.h
  3 Project:   xmlBlaster.org
  4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
  5 ------------------------------------------------------------------------------*/
  6 
  7 /**
  8  * QoS (quality of service) informations sent from server to client<br />
  9  * via the update() method from the org::xmlBlaster::client::I_Callback interface.
 10  * <p />
 11  * If you are a Java client you may use this class to parse the QoS argument.
 12  * <p />
 13  * Example:
 14  * <pre>
 15  *   &lt;qos> &lt;!-- UpdateQos -->
 16  *     &lt;state id='OK'/>
 17  *     &lt;sender>Tim&lt;/sender>
 18  *     &lt;priority>5&lt;/priority>
 19  *     &lt;subscribe id='__subId:1'/&lt;
 20  *     &lt;rcvTimestamp nanos='1007764305862000002'> &lt;!-- UTC time when message was created in xmlBlaster server with a publish() call, in nanoseconds since 1970 -->
 21  *           2001-12-07 23:31:45.862000002   &lt;!-- The nanos from above but human readable -->
 22  *     &lt;/rcvTimestamp>
 23  *     &lt;expiration lifeTime='1200'/> &lt;!-- The overall life time of the message [milliseconds] -->
 24  *     &lt;queue index='0' of='1'/> &lt;!-- If queued messages are flushed on login -->
 25  *     &lt;redeliver>4&lt;/redeliver>
 26  *     &lt;route>
 27  *        &lt;node id='heron'/>
 28  *     &lt;/route>
 29  *  &lt;/qos>
 30  * </pre>
 31  * The receive timestamp can be delivered in human readable form as well
 32  * by setting on server command line:
 33  * <pre>
 34  *   -cb.receiveTimestampHumanReadable true
 35  *
 36  *   &lt;rcvTimestamp nanos='1015959656372000000'>
 37  *     2002-03-12 20:00:56.372
 38  *   &lt;/rcvTimestamp>
 39  * </pre>
 40  * @see org.xmlBlaster.util.qos.MsgQosData
 41  * @see org.xmlBlaster.util.qos.MsgQosSaxFactory
 42  * @see <a href="http://www.xmlblaster.org/xmlBlaster/doc/requirements/interface.update.html">update interface</a>
 43  */
 44 
 45 #ifndef _CLIENT_QOS_UPDATEQOS_H
 46 #define _CLIENT_QOS_UPDATEQOS_H
 47 
 48 # include <client/qos/GetReturnQos.h>
 49 
 50 
 51 
 52 
 53 
 54 
 55 namespace org { namespace xmlBlaster { namespace client { namespace qos {
 56 
 57 class Dll_Export UpdateQos: public GetReturnQos
 58 {
 59 
 60 public:
 61 
 62    UpdateQos(org::xmlBlaster::util::Global& global, const org::xmlBlaster::util::qos::MsgQosData data);
 63 
 64    UpdateQos(const UpdateQos& data);
 65 
 66    UpdateQos& operator=(const UpdateQos& data);
 67 
 68    /**
 69     * Test if Publish/Subscribe style is used.
 70     *
 71     * @return true if Publish/Subscribe style is used
 72     */
 73    bool isSubscribable() const;
 74 
 75    /**
 76     * Test if Point to Point addressing style is used.
 77     *
 78     * @return true if addressing of the destination is used
 79     *         false if no destination is given
 80     */
 81    bool isPtp();
 82 
 83    /**
 84     * If Pub/Sub style update: contains the subscribe ID which caused this update
 85     * @return subscribeId or null if PtP message
 86     */
 87    std::string getSubscriptionId() const;
 88 
 89    /**
 90     * Returns > 0 if the message probably is redelivered. 
 91     * @return == 0 The message is guaranteed to be delivered only once.
 92     */
 93    int getRedeliver() const;
 94 
 95     /**
 96     * @return The number of queued messages
 97     */
 98    long getQueueSize() const;
 99 
100    /**
101     * @return The index of the message in the queue
102     */
103    long getQueueIndex() const;
104 
105    /**
106     * True if the message is OK
107     */
108    bool isOk() const;
109 
110    /**
111     * True if the message was erased by timer or by a
112     * client invoking erase(). 
113     */
114    bool isErased() const;
115 
116    /**
117     * True if a timeout on this message occurred. 
118     * <p />
119     * Timeouts are spanned by the publisher and thrown by xmlBlaster
120     * on timeout to indicate for example
121     * STALE messages or any other user problem domain specific event.
122     */
123    bool isTimeout() const;
124 
125    /**
126     * True on cluster forward problems
127     */
128    bool isForwardError() const;
129 };
130 
131 }}}}
132 
133 #endif


syntax highlighted by Code2HTML, v. 0.9.1