SubscribeDemo Class Reference

This subscriber subscribes on the topic 'Hello' and dumps the received messages. More...

Inheritance diagram for SubscribeDemo:

Inheritance graph
[legend]
Collaboration diagram for SubscribeDemo:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SubscribeDemo (Global &glob)
I_LoggetLog ()
void execute ()
void initEnvironment ()
bool reachedAlive (StatesEnum, I_ConnectionsHandler *connectionsHandler)
 This is the callback method invoked from org::xmlBlaster::util::dispatch::ConnectionsHandler notifying the client that a connection has been established and that its status is now ALIVE.
void reachedDead (StatesEnum, I_ConnectionsHandler *)
 This is the callback method invoked from org::xmlBlaster::util::dispatch::ConnectionsHandler informing the client that the connection was lost (i.e.
void reachedPolling (StatesEnum, I_ConnectionsHandler *)
 This is the callback method invoked from org::xmlBlaster::util::dispatch::ConnectionsHandler informing the client that the connection state has changed to POLLING.
void connect ()
void subscribe ()
void unSubscribe_ ()
void disconnect_ ()
string update (string &sessionId, UpdateKey &updateKey, unsigned char *content, long contentSize, UpdateQos &updateQos)
 Here we receive the asynchronous callback messages from the xmlBlaster server.

Public Attributes

bool doContinue_

Detailed Description

This subscriber subscribes on the topic 'Hello' and dumps the received messages.

Please start the publisher demo PublishDemo -numPublish 10 to receives some messages

Definition at line 48 of file SubscribeDemo.cpp.


Constructor & Destructor Documentation

SubscribeDemo::SubscribeDemo ( Global glob  ) 

Definition at line 90 of file SubscribeDemo.cpp.

References doContinue_, execute(), and initEnvironment().


Member Function Documentation

I_Log& SubscribeDemo::getLog (  ) 

Definition at line 104 of file SubscribeDemo.cpp.

Referenced by ProgressListener::progress().

void SubscribeDemo::execute (  ) 

Definition at line 106 of file SubscribeDemo.cpp.

References connect(), disconnect_(), doContinue_, org::xmlBlaster::util::I_Log::info(), org::xmlBlaster::util::I_Log::plain(), org::xmlBlaster::client::XmlBlasterAccess::setCallbackDispatcherActive(), org::xmlBlaster::util::thread::Thread::sleepSecs(), subscribe(), and unSubscribe_().

Referenced by SubscribeDemo().

void SubscribeDemo::initEnvironment (  ) 

Definition at line 138 of file SubscribeDemo.cpp.

References org::xmlBlaster::util::Property::get(), org::xmlBlaster::util::Global::getProperty(), org::xmlBlaster::util::I_Log::info(), and org::xmlBlaster::util::I_Log::warn().

Referenced by SubscribeDemo().

bool SubscribeDemo::reachedAlive ( StatesEnum  oldState,
I_ConnectionsHandler connectionsHandler 
) [virtual]

This is the callback method invoked from org::xmlBlaster::util::dispatch::ConnectionsHandler notifying the client that a connection has been established and that its status is now ALIVE.

It has a bool return which informs the org::xmlBlaster::util::dispatch::ConnectionsHandler what to do with the entries in the queue. If you return 'true', then the queue is flushed (i.e. the contents of the queue are sent to xmlBlaster). If you return 'false', then the contents of the queue are left untouched. You can then erase all entries manually. Note that this method is invoked also when the connection has been established the first time.

Implements org::xmlBlaster::client::I_ConnectionProblems.

Definition at line 214 of file SubscribeDemo.cpp.

References org::xmlBlaster::util::dispatch::I_ConnectionsHandler::getConnectReturnQos(), org::xmlBlaster::util::I_Log::info(), and subscribe().

void SubscribeDemo::reachedDead ( StatesEnum  oldState,
I_ConnectionsHandler connectionsHandler 
) [virtual]

This is the callback method invoked from org::xmlBlaster::util::dispatch::ConnectionsHandler informing the client that the connection was lost (i.e.

when the state of the connectionsHandler has gone to DEAD).

Implements org::xmlBlaster::client::I_ConnectionProblems.

Definition at line 223 of file SubscribeDemo.cpp.

References org::xmlBlaster::util::I_Log::info().

void SubscribeDemo::reachedPolling ( StatesEnum  oldState,
I_ConnectionsHandler connectionsHandler 
) [virtual]

This is the callback method invoked from org::xmlBlaster::util::dispatch::ConnectionsHandler informing the client that the connection state has changed to POLLING.

Implements org::xmlBlaster::client::I_ConnectionProblems.

Definition at line 228 of file SubscribeDemo.cpp.

References org::xmlBlaster::util::I_Log::info().

void SubscribeDemo::connect (  ) 

Definition at line 233 of file SubscribeDemo.cpp.

References org::xmlBlaster::client::XmlBlasterAccess::connect(), org::xmlBlaster::util::qos::ConnectQosData::getCbAddress(), org::xmlBlaster::client::XmlBlasterAccess::initFailsafe(), org::xmlBlaster::client::XmlBlasterAccess::registerProgressListener(), org::xmlBlaster::util::qos::ConnectQosData::toXml(), and org::xmlBlaster::util::I_Log::trace().

Referenced by execute().

void SubscribeDemo::subscribe (  ) 

Definition at line 246 of file SubscribeDemo.cpp.

References org::xmlBlaster::client::qos::GetQos::addAccessFilter(), org::xmlBlaster::util::Constants::D_O_M_A_I_N, org::xmlBlaster::util::I_Log::dump(), org::xmlBlaster::client::qos::SubscribeReturnQos::getSubscriptionId(), org::xmlBlaster::util::I_Log::info(), org::xmlBlaster::client::key::SubscribeKey::setDomain(), org::xmlBlaster::client::qos::GetQos::setHistoryQos(), org::xmlBlaster::client::qos::SubscribeQos::setMultiSubscribe(), org::xmlBlaster::util::qos::HistoryQos::setNewestFirst(), org::xmlBlaster::util::qos::HistoryQos::setNumEntries(), org::xmlBlaster::client::key::UnSubscribeKey::setOid(), org::xmlBlaster::client::qos::SubscribeQos::setPersistent(), org::xmlBlaster::client::key::UnSubscribeKey::setQueryString(), org::xmlBlaster::client::qos::GetQos::setWantContent(), org::xmlBlaster::client::qos::SubscribeQos::setWantInitialUpdate(), org::xmlBlaster::client::qos::SubscribeQos::setWantLocal(), org::xmlBlaster::client::qos::SubscribeQos::setWantNotify(), org::xmlBlaster::client::qos::SubscribeQos::setWantUpdateOneway(), org::xmlBlaster::client::XmlBlasterAccess::subscribe(), org::xmlBlaster::client::qos::SubscribeReturnQos::toXml(), org::xmlBlaster::client::qos::UnSubscribeQos::toXml(), and org::xmlBlaster::client::key::UnSubscribeKey::toXml().

Referenced by execute(), reachedAlive(), and update().

void SubscribeDemo::unSubscribe_ (  ) 

Definition at line 309 of file SubscribeDemo.cpp.

References org::xmlBlaster::util::I_Log::info(), org::xmlBlaster::client::key::UnSubscribeKey::setDomain(), org::xmlBlaster::client::qos::UnSubscribeQos::toXml(), org::xmlBlaster::client::key::UnSubscribeKey::toXml(), and org::xmlBlaster::client::XmlBlasterAccess::unSubscribe().

Referenced by execute().

void SubscribeDemo::disconnect_ (  ) 

Definition at line 328 of file SubscribeDemo.cpp.

References org::xmlBlaster::client::XmlBlasterAccess::disconnect(), and org::xmlBlaster::util::I_Log::info().

Referenced by execute().

string SubscribeDemo::update ( string &  sessionId,
UpdateKey updateKey,
unsigned char *  content,
long  contentSize,
UpdateQos updateQos 
)

Here we receive the asynchronous callback messages from the xmlBlaster server.

Definition at line 340 of file SubscribeDemo.cpp.

References org::xmlBlaster::client::qos::GetReturnQos::getClientProperties(), org::xmlBlaster::client::qos::GetReturnQos::getClientProperty(), org::xmlBlaster::client::key::MsgKeyBase::getOid(), org::xmlBlaster::client::qos::GetReturnQos::hasClientProperty(), org::xmlBlaster::util::I_Log::info(), org::xmlBlaster::client::qos::UpdateQos::isErased(), org::xmlBlaster::util::I_Log::plain(), org::xmlBlaster::util::Constants::RET_OK, org::xmlBlaster::util::thread::Thread::sleep(), subscribe(), org::xmlBlaster::client::qos::GetReturnQos::toXml(), and org::xmlBlaster::client::key::MsgKeyBase::toXml().


Member Data Documentation

bool SubscribeDemo::doContinue_

Definition at line 88 of file SubscribeDemo.cpp.

Referenced by execute(), and SubscribeDemo().


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