com::pcbsys::nirvana::client::nQueueReaderContext Class Reference

This class is used to construct a Queue Reader. More...

#include <nQueueReaderContext.h>

Inherits CountableObject.

Public Member Functions

nEventListenergetListener ()
 Returns the current event listener being used. More...
 
int getPeekBatchSize ()
 Retrieves the current peek batch size. More...
 
std::string getSelector ()
 Returns the current selector that this context was constructed with, could be null. More...
 
nMessageValidator * getValidator ()
 Retrieves the current message validator. More...
 
int getWindow ()
 Retrieves the current window size. More...
 
 nQueueReaderContext (void)
 Default constructor, useful for creating a standard synchronous queue reader.
 
 nQueueReaderContext (nEventListener *pListener, const std::string &selector, int windowSize=0)
 This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored. More...
 
 nQueueReaderContext (nEventListener *pListener, int windowSize=0)
 This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored. More...
 
 nQueueReaderContext (const std::string &selector)
 This constructor supports a standard synchronous queue reader with the message selector applied. More...
 
void setListener (nEventListener *pListener)
 Sets the current listener. More...
 
void setPeekBatchSize (int peekBatchSize)
 Sets the peek batch size, this is hte number of events a single call to the server will return. More...
 
void setSelector (const std::string &selector)
 Sets the message selector. More...
 
void setValidator (nMessageValidator *pValidator)
 Sets the current message validator. More...
 
void setWindow (int window)
 Sets the window size. More...
 

Detailed Description

This class is used to construct a Queue Reader.

Constructor & Destructor Documentation

com::pcbsys::nirvana::client::nQueueReaderContext::nQueueReaderContext ( nEventListener pListener,
const std::string &  selector,
int  windowSize = 0 
)

This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored.

The message selector will be applied to all events prior to being delivered to the client from the server.

Parameters
*pListenerAsynchronous callback object
selectorMessage selector to be applied to the events prior to being delivered to the client
windowSizeNumber of events that the server will deliver prior to expecting a commit or rollback
com::pcbsys::nirvana::client::nQueueReaderContext::nQueueReaderContext ( nEventListener pListener,
int  windowSize = 0 
)

This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored.

Parameters
*pListenerAsynchronous callback object
windowSizeNumber of events that the server will deliver prior to expecting a commit or rollback
com::pcbsys::nirvana::client::nQueueReaderContext::nQueueReaderContext ( const std::string &  selector)

This constructor supports a standard synchronous queue reader with the message selector applied.

Parameters
selectorMessage selector to be applied to the events prior to being delivered to the client

Member Function Documentation

nEventListener* com::pcbsys::nirvana::client::nQueueReaderContext::getListener ( )

Returns the current event listener being used.

Returns
current listener
int com::pcbsys::nirvana::client::nQueueReaderContext::getPeekBatchSize ( )

Retrieves the current peek batch size.

Returns
peek batch size
std::string com::pcbsys::nirvana::client::nQueueReaderContext::getSelector ( )

Returns the current selector that this context was constructed with, could be null.

Returns
Message Selector
nMessageValidator* com::pcbsys::nirvana::client::nQueueReaderContext::getValidator ( )

Retrieves the current message validator.

This could be null.

Returns
Message Validator
int com::pcbsys::nirvana::client::nQueueReaderContext::getWindow ( )

Retrieves the current window size.

This is the number of events the server will send prior to expecting an rollback or a commit. No more events will be sent when this number is reached an no call is made.

Returns
current window size
void com::pcbsys::nirvana::client::nQueueReaderContext::setListener ( nEventListener pListener)

Sets the current listener.

This has no effect if the reader has been created prior to calling this method. The reader will need to be destroyed and recreated.

Parameters
*pListenerEvent listener.
void com::pcbsys::nirvana::client::nQueueReaderContext::setPeekBatchSize ( int  peekBatchSize)

Sets the peek batch size, this is hte number of events a single call to the server will return.

Parameters
peekBatchSizethe peek batch size to use
void com::pcbsys::nirvana::client::nQueueReaderContext::setSelector ( const std::string &  selector)

Sets the message selector.

If the reader has already been created this method does nothing. If the reader is an asynchronous queue reader then the existing reader must be destroyed and recreated before this selector will take effect else the next pop will take this into account

Parameters
selectora Message selector
void com::pcbsys::nirvana::client::nQueueReaderContext::setValidator ( nMessageValidator *  pValidator)

Sets the current message validator.

It has no effect if the reader is an asynchronous queue reader and the reader will need to be destroyed and recreated prior to this taking effect. If the reader is an synchronous queue reader the next event popped will use the message validator.

Parameters
*pValidatorThe message validator to use.
void com::pcbsys::nirvana::client::nQueueReaderContext::setWindow ( int  window)

Sets the window size.

This function has no effect on synchronous readers and if the asynchronous reader is constructed prior to this method then it will not take effect until the reader is destroyed and recreated.

Parameters
windowthe window size to use