xmlBlaster 2.2.0 client API

org.xmlBlaster.client.qos
Class UpdateQos

java.lang.Object
  extended by org.xmlBlaster.client.qos.UpdateQos

public final class UpdateQos
extends java.lang.Object

QoS (quality of service) informations sent from server to client
via the update() method from the I_Callback interface.

If you are a Java client you may use this class to parse the QoS argument.

Example:

   <qos> <!-- UpdateQos -->
     <state id='OK'/>
     <sender>Tim</sender>
     <priority>5</priority>
     <subscribe id='__subId:1/>
     <rcvTimestamp nanos='1007764305862000002'> <!-- UTC time when message was created in xmlBlaster server with a publish() call, in nanoseconds since 1970 -->
           2001-12-07 23:31:45.862000002   <!-- The nanos from above but human readable -->
     </rcvTimestamp>
     <expiration lifeTime='1200'/> <!-- The overall life time of the message [milliseconds] -->
     <queue index='0' of='1'/> <!-- If queued messages are flushed on login -->
     <redeliver>4</redeliver>
     <route>
        <node id='heron'/>
     </route>
     <clientProperty name='transactionId' type='int'>120001</clientProperty>
     <clientProperty name='transactionId' type='String' encoding='base64'>OKFKAL==</clientProperty>
  </qos>
 
The receive timestamp can be delivered in human readable form as well by setting on server command line:
   -cb.receiveTimestampHumanReadable true

   <rcvTimestamp nanos='1015959656372000000'>
     2002-03-12 20:00:56.372
   </rcvTimestamp>
 

See Also:
MsgQosData, MsgQosSaxFactory, update interface

Constructor Summary
UpdateQos(Global glob, MsgQosData msgQosData)
          Default constructor for transient messages.
UpdateQos(Global glob, java.lang.String xmlQos)
          Constructs the specialized quality of service object for a update() call.
 
Method Summary
 java.util.Map getClientProperties()
          Access all client properties.
 ClientProperty getClientProperty(java.lang.String key)
          Read back a property.
 boolean getClientProperty(java.lang.String name, boolean defaultValue)
          Access the boolean client property.
 byte getClientProperty(java.lang.String name, byte defaultValue)
          Access the byte client property.
 byte[] getClientProperty(java.lang.String name, byte[] defaultValue)
          Access the byte[] client property.
 double getClientProperty(java.lang.String name, double defaultValue)
          Access the double client property.
 float getClientProperty(java.lang.String name, float defaultValue)
          Access the float client property.
 int getClientProperty(java.lang.String name, int defaultValue)
          Access the integer client property.
 long getClientProperty(java.lang.String name, long defaultValue)
          Access the long client property.
 short getClientProperty(java.lang.String name, short defaultValue)
          Access the short client property.
 java.lang.String getClientProperty(java.lang.String name, java.lang.String defaultValue)
          Access the String client property.
 java.lang.String getContentStr(byte[] msgContent)
          Convenience method to get the raw content as a string, the encoding is UTF-8 if not specified by clientProperty Constants.CLIENTPROPERTY_CONTENT_CHARSET
 java.lang.String getContentStrNoEx(byte[] msgContent)
          Convenience method to get the raw content as a string, the encoding is UTF-8 if not specified by clientProperty Constants.CLIENTPROPERTY_CONTENT_CHARSET
 MsgQosData getData()
          Get the QoS data object which i'm hiding
 Global getGlobal()
           
 PriorityEnum getPriority()
          Message priority.
 long getQueueIndex()
          If persistent messages where in queue, this is flushed on login.
 long getQueueSize()
          If persistent messages where in queue, this is flushed on login.
 java.lang.String getRcvTime()
          Human readable form of message receive time in xmlBlaster server, in SQL representation e.g.:
2001-12-07 23:31:45.862000004
 Timestamp getRcvTimestamp()
          The approximate receive timestamp (UTC time), when message was created - arrived at xmlBlaster server.
In nanoseconds elapsed since midnight, January 1, 1970 UTC
 int getRedeliver()
          Returns > 0 if the message probably is redelivered.
 long getRemainingLifeStatic()
          Approxiamte millis counted from now when message will be discarded by xmlBlaster.
 RouteInfo[] getRouteNodes()
           
 SessionName getSender()
          Access sender name.
 java.lang.String getState()
          Access state of message.
 java.lang.String getSubscriptionId()
          If Pub/Sub style update: contains the subscribe ID which caused this update
 boolean isErased()
          True if the message was erased by timer or by a client invoking erase().
 boolean isForwardError()
          True on cluster forward problems
 boolean isOk()
          True if the message is OK
 boolean isPersistent()
          Is this a persistent message?
 boolean isPtp()
          Did i reveive the message in PtP mode?
 boolean isReadonly()
          Is this a readonly message?
 boolean isSubscribable()
          Was this message subscribed?
 boolean isTimeout()
          True if a timeout on this message occurred.
 boolean isVolatile()
          Is this a volatile message?
 java.lang.String toString()
           
 java.lang.String toXml()
          Dump state of this object into a XML ASCII string.
 java.lang.String toXml(java.lang.String extraOffset)
          Dump state of this object into a XML ASCII string.
 java.lang.String toXml(java.lang.String extraOffset, java.util.Properties props)
          Overwrite qosData.toXml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UpdateQos

public UpdateQos(Global glob,
                 MsgQosData msgQosData)
Default constructor for transient messages.


UpdateQos

public UpdateQos(Global glob,
                 java.lang.String xmlQos)
          throws XmlBlasterException
Constructs the specialized quality of service object for a update() call.

Throws:
XmlBlasterException
Method Detail

getContentStr

public java.lang.String getContentStr(byte[] msgContent)
                               throws XmlBlasterException
Convenience method to get the raw content as a string, the encoding is UTF-8 if not specified by clientProperty Constants.CLIENTPROPERTY_CONTENT_CHARSET

Returns:
never null
Throws:
XmlBlasterException

getContentStrNoEx

public java.lang.String getContentStrNoEx(byte[] msgContent)
Convenience method to get the raw content as a string, the encoding is UTF-8 if not specified by clientProperty Constants.CLIENTPROPERTY_CONTENT_CHARSET

Returns:
never null

getData

public MsgQosData getData()
Get the QoS data object which i'm hiding


getGlobal

public Global getGlobal()

getSender

public SessionName getSender()
Access sender name.

Returns:
loginName and session of sender

getPriority

public PriorityEnum getPriority()
Message priority.

Returns:
priority 0-9
See Also:
Constants

getRedeliver

public int getRedeliver()
Returns > 0 if the message probably is redelivered.

Returns:
== 0 The message is guaranteed to be delivered only once.

getState

public java.lang.String getState()
Access state of message.

Returns:
OK (Other values are not yet supported)

isOk

public boolean isOk()
True if the message is OK


isErased

public boolean isErased()
True if the message was erased by timer or by a client invoking erase().


isTimeout

public boolean isTimeout()
True if a timeout on this message occurred.

Timeouts are spanned by the publisher and thrown by xmlBlaster on timeout to indicate for example STALE messages or any other user problem domain specific event.


isForwardError

public boolean isForwardError()
True on cluster forward problems


isVolatile

public boolean isVolatile()
Is this a volatile message?


isSubscribable

public boolean isSubscribable()
Was this message subscribed?


isPtp

public boolean isPtp()
Did i reveive the message in PtP mode?


isPersistent

public boolean isPersistent()
Is this a persistent message?


isReadonly

public boolean isReadonly()
Is this a readonly message?


getSubscriptionId

public java.lang.String getSubscriptionId()
If Pub/Sub style update: contains the subscribe ID which caused this update

Returns:
subscribeId or null if PtP message

getQueueSize

public long getQueueSize()
If persistent messages where in queue, this is flushed on login.

Returns:
The number of queued messages

getQueueIndex

public long getQueueIndex()
If persistent messages where in queue, this is flushed on login.

Returns:
The index of the message of the queue

getRcvTimestamp

public Timestamp getRcvTimestamp()
The approximate receive timestamp (UTC time), when message was created - arrived at xmlBlaster server.
In nanoseconds elapsed since midnight, January 1, 1970 UTC


getRcvTime

public java.lang.String getRcvTime()
Human readable form of message receive time in xmlBlaster server, in SQL representation e.g.:
2001-12-07 23:31:45.862000004


getRemainingLifeStatic

public long getRemainingLifeStatic()
Approxiamte millis counted from now when message will be discarded by xmlBlaster. Calculated by xmlBlaster just before sending the update, so there will be an offset (the time sending the message to us).

Returns:
The time to live for this message or -1 (unlimited) if not known

getRouteNodes

public RouteInfo[] getRouteNodes()
Returns:
never null, but may have length==0

getClientProperties

public final java.util.Map getClientProperties()
Access all client properties.

Returns:
a map The return is unordered and the map values are of type ClientProperty.
See Also:
ClientProperty

getClientProperty

public ClientProperty getClientProperty(java.lang.String key)
Read back a property.

Returns:
The client property or null if not found

getClientProperty

public final java.lang.String getClientProperty(java.lang.String name,
                                                java.lang.String defaultValue)
Access the String client property.

Parameters:
name - The property key
defaultValue - The value to return if the property is not known

getClientProperty

public final int getClientProperty(java.lang.String name,
                                   int defaultValue)
Access the integer client property.

Parameters:
name - The property key
defaultValue - The value to return if the property is not known

getClientProperty

public final boolean getClientProperty(java.lang.String name,
                                       boolean defaultValue)
Access the boolean client property.

Parameters:
name - The property key
defaultValue - The value to return if the property is not known

getClientProperty

public final double getClientProperty(java.lang.String name,
                                      double defaultValue)
Access the double client property.

Parameters:
name - The property key
defaultValue - The value to return if the property is not known

getClientProperty

public final float getClientProperty(java.lang.String name,
                                     float defaultValue)
Access the float client property.

Parameters:
name - The property key
defaultValue - The value to return if the property is not known

getClientProperty

public final byte getClientProperty(java.lang.String name,
                                    byte defaultValue)
Access the byte client property.

Parameters:
name - The property key
defaultValue - The value to return if the property is not known

getClientProperty

public final byte[] getClientProperty(java.lang.String name,
                                      byte[] defaultValue)
Access the byte[] client property.

Parameters:
name - The property key
defaultValue - The value to return if the property is not known

getClientProperty

public final long getClientProperty(java.lang.String name,
                                    long defaultValue)
Access the long client property.

Parameters:
name - The property key
defaultValue - The value to return if the property is not known

getClientProperty

public final short getClientProperty(java.lang.String name,
                                     short defaultValue)
Access the short client property.

Parameters:
name - The property key
defaultValue - The value to return if the property is not known

toXml

public java.lang.String toXml()
Dump state of this object into a XML ASCII string.

Returns:
internal state of the RequestBroker as a XML ASCII string

toXml

public java.lang.String toXml(java.lang.String extraOffset)
Dump state of this object into a XML ASCII string.

Parameters:
extraOffset - indenting of tags for nice output
Returns:
internal state of the RequestBroker as a XML ASCII string

toXml

public java.lang.String toXml(java.lang.String extraOffset,
                              java.util.Properties props)
Overwrite qosData.toXml

Parameters:
extraOffset -
forceReadable -
Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

xmlBlaster 2.2.0 client API

Copyright © 1999-2014 The xmlBlaster.org contributers.