org::xmlBlaster::client::qos::SubscribeQos Class Reference

This class encapsulates the QoS (quality of service) of a subscribe() request. More...

Inheritance diagram for org::xmlBlaster::client::qos::SubscribeQos:

Inheritance graph
[legend]
Collaboration diagram for org::xmlBlaster::client::qos::SubscribeQos:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SubscribeQos (org::xmlBlaster::util::Global &global)
 SubscribeQos (org::xmlBlaster::util::Global &global, org::xmlBlaster::util::qos::QueryQosData &data)
 SubscribeQos (SubscribeQos &qos)
SubscribeQosoperator= (SubscribeQos &qos)
void setWantInitialUpdate (bool initialUpdate)
 Do we want to have an initial update on subscribe if the message exists already?
void setWantUpdateOneway (bool updateOneway)
 Do we want the callback messages of this subscription as oneway with updateOneway() or with the acknowledged update().
void setMultiSubscribe (bool multiSubscribe)
 Are multiple subscribes allowed? Defaults to true.
bool getMultiSubscribe ()
void setWantLocal (bool local)
 false Inhibit the delivery of messages to myself if i have published it.
void setWantNotify (bool notifyOnErase)
 Notify me when the topic is erased on which i have subscribed.
void setSubscriptionId (std::string &subscriptionId)
 Force the identifier (unique handle) for this subscription.
std::string generateSubscriptionId (org::xmlBlaster::util::SessionNameRef sessionName, org::xmlBlaster::client::key::SubscribeKey &subscribeKey)
 A client side subscriptionId must start with "__subId:" followed by the relative session name.
bool hasSubscriptionId ()
void setPersistent (bool persistent)
 Sets the subscription to persistent (true) or not persistent (false).
template<typename T_VALUE>
void addClientProperty (std::string &name, T_VALUE &value, std::string &type="", std::string &encoding="")
 Add a client property key and value.

Detailed Description

This class encapsulates the QoS (quality of service) of a subscribe() request.

A full specified subscribe qos could look like this:

<qos>
   <id>__subId:/node/heron/client/joe/3/34</id> < Force a subscription ID from client side -->
   <meta>false</meta>       <!-- Don't send me the xmlKey meta data on updates -->
   <content>false</content> <!-- Don't send me the content data on updates (notify only) -->
   <local>false</local>     <!-- Inhibit the delivery of messages to myself if i have published it -->
   <initialUpdate>false</initialUpdate>;
   <updateOneway>false</updateOneway>;
   <filter type='myPlugin' version='1.0'>a!=100</filter>
                                  <!-- Filters messages i have subscribed as implemented in your plugin -->
   <history numEntries='20'/>  <!-- Default is to deliver the current entry (numEntries='1'), '-1' deliver all -->
</qos>
 

see xmlBlaster/src/dtd/XmlQoS.xml

See also:
org.xmlBlaster.util.qos.QueryQosData

org.xmlBlaster.util.qos.QueryQosSaxFactory

subscribe interface

MIME access filter requirement

Definition at line 41 of file SubscribeQos.h.


Constructor & Destructor Documentation

org::xmlBlaster::client::qos::SubscribeQos::SubscribeQos ( org::xmlBlaster::util::Global global  ) 

Definition at line 25 of file SubscribeQos.cpp.

References org::xmlBlaster::client::qos::UnSubscribeQos::ME.

org::xmlBlaster::client::qos::SubscribeQos::SubscribeQos ( org::xmlBlaster::util::Global global,
org::xmlBlaster::util::qos::QueryQosData data 
)

Definition at line 30 of file SubscribeQos.cpp.

References org::xmlBlaster::client::qos::UnSubscribeQos::ME.

org::xmlBlaster::client::qos::SubscribeQos::SubscribeQos ( SubscribeQos qos  ) 

Definition at line 36 of file SubscribeQos.cpp.


Member Function Documentation

SubscribeQos & org::xmlBlaster::client::qos::SubscribeQos::operator= ( SubscribeQos qos  ) 

Definition at line 40 of file SubscribeQos.cpp.

References org::xmlBlaster::client::qos::UnSubscribeQos::data_.

void org::xmlBlaster::client::qos::SubscribeQos::setWantInitialUpdate ( bool  initialUpdate  ) 

Do we want to have an initial update on subscribe if the message exists already?

Returns:
true if initial update wanted false if only updates on new publishes are sent
See also:
The engine.qos.subscribe.initialUpdate requirement

Definition at line 55 of file SubscribeQos.cpp.

References org::xmlBlaster::client::qos::UnSubscribeQos::data_, and org::xmlBlaster::util::qos::QueryQosData::setWantInitialUpdate().

Referenced by SubscribeDemo::subscribe().

void org::xmlBlaster::client::qos::SubscribeQos::setWantUpdateOneway ( bool  updateOneway  ) 

Do we want the callback messages of this subscription as oneway with updateOneway() or with the acknowledged update().

Parameters:
updateOneway Defaults to false.
See also:
The interface.subscribe requirement

QueryQosData::setWantUpdateOneway(boolean)

Definition at line 67 of file SubscribeQos.cpp.

References org::xmlBlaster::client::qos::UnSubscribeQos::data_, and org::xmlBlaster::util::qos::QueryQosData::setWantUpdateOneway().

Referenced by SubscribeDemo::subscribe().

void org::xmlBlaster::client::qos::SubscribeQos::setMultiSubscribe ( bool  multiSubscribe  ) 

Are multiple subscribes allowed? Defaults to true.

Parameters:
multiSubscribe defaults to true

Definition at line 78 of file SubscribeQos.cpp.

References org::xmlBlaster::client::qos::UnSubscribeQos::data_, and org::xmlBlaster::util::qos::QueryQosData::setMultiSubscribe().

Referenced by HelloWorld2::execute(), and SubscribeDemo::subscribe().

bool org::xmlBlaster::client::qos::SubscribeQos::getMultiSubscribe (  ) 

Definition at line 110 of file SubscribeQos.cpp.

References org::xmlBlaster::client::qos::UnSubscribeQos::data_, and org::xmlBlaster::util::qos::QueryQosData::getMultiSubscribe().

Referenced by generateSubscriptionId(), and org::xmlBlaster::client::XmlBlasterAccess::subscribe().

void org::xmlBlaster::client::qos::SubscribeQos::setWantLocal ( bool  local  ) 

false Inhibit the delivery of messages to myself if i have published it.

Definition at line 86 of file SubscribeQos.cpp.

References org::xmlBlaster::client::qos::UnSubscribeQos::data_, and org::xmlBlaster::util::qos::QueryQosData::setWantLocal().

Referenced by SubscribeDemo::subscribe().

void org::xmlBlaster::client::qos::SubscribeQos::setWantNotify ( bool  notifyOnErase  ) 

Notify me when the topic is erased on which i have subscribed.

Parameters:
notifyOnErase defaults to true

Definition at line 91 of file SubscribeQos.cpp.

References org::xmlBlaster::client::qos::UnSubscribeQos::data_, and org::xmlBlaster::util::qos::QueryQosData::setWantNotify().

Referenced by SubscribeDemo::subscribe().

void org::xmlBlaster::client::qos::SubscribeQos::setSubscriptionId ( std::string &  subscriptionId  ) 

Force the identifier (unique handle) for this subscription.

Usually you let the identifier be generated by xmlBlaster. The call is handled as 'logically const'

See also:
The engine.qos.subscribe.id requirement

Referenced by generateSubscriptionId(), and org::xmlBlaster::util::dispatch::ConnectionsHandler::queueSubscribe().

std::string org::xmlBlaster::client::qos::SubscribeQos::generateSubscriptionId ( org::xmlBlaster::util::SessionNameRef  sessionName,
org::xmlBlaster::client::key::SubscribeKey subscribeKey 
)

A client side subscriptionId must start with "__subId:" followed by the relative session name.

This us only useful for positive session Ids in fail save environments: if the subscription is queued the faked subscriptionId will be used later by the server

Parameters:
sessionName 
subscribeKey 
Returns:
e.g. "__subId:client/joe/session/1-XPATH://key" for pubSessionId>0 and multiSubscribe=false or e.g. "__subId:client/joe-135692304540000" in other cases

Definition at line 114 of file SubscribeQos.cpp.

References org::xmlBlaster::client::qos::UnSubscribeQos::data_, org::xmlBlaster::util::TimestampFactory::getInstance, getMultiSubscribe(), org::xmlBlaster::util::qos::QueryQosData::getSubscriptionId(), org::xmlBlaster::util::TimestampFactory::getTimestamp(), org::xmlBlaster::client::key::UnSubscribeKey::getUrl(), org::xmlBlaster::util::lexical_cast(), org::xmlBlaster::util::StringTrim::replaceAll(), setSubscriptionId(), and org::xmlBlaster::util::Constants::SUBSCRIPTIONID_PREFIX.

Referenced by org::xmlBlaster::util::dispatch::ConnectionsHandler::queueSubscribe().

bool org::xmlBlaster::client::qos::SubscribeQos::hasSubscriptionId (  ) 

Definition at line 106 of file SubscribeQos.cpp.

References org::xmlBlaster::client::qos::UnSubscribeQos::data_, and org::xmlBlaster::util::qos::QueryQosData::getSubscriptionId().

Referenced by org::xmlBlaster::client::XmlBlasterAccess::subscribe().

void org::xmlBlaster::client::qos::SubscribeQos::setPersistent ( bool  persistent  ) 

Sets the subscription to persistent (true) or not persistent (false).

Setting this to true means that the subscription will implicitly make the associated session persistent and both will survive a server crash.

Definition at line 142 of file SubscribeQos.cpp.

References org::xmlBlaster::client::qos::UnSubscribeQos::data_, and org::xmlBlaster::util::qos::QosData::setPersistent().

Referenced by SubscribeDemo::subscribe().

template<typename T_VALUE>
void org::xmlBlaster::client::qos::SubscribeQos::addClientProperty ( std::string &  name,
T_VALUE &  value,
std::string &  type = "",
std::string &  encoding = "" 
)

Add a client property key and value.

Parameters:
name The unique key, a duplicate key will overwrite the old setting
value "vector<unsigned char>" and "unsigned char *" types are treated as a blob
See also:
ClientProperty::ClientProperty

Reimplemented from org::xmlBlaster::client::qos::GetQos.

Definition at line 125 of file SubscribeQos.h.


The documentation for this class was generated from the following files: