com::pcbsys::nirvana::client::nQueueReader Class Referenceabstract

This class is the base class for all Queue Readers and provides a generic reader interface. More...

#include <nQueueReader.h>

Inheritance diagram for com::pcbsys::nirvana::client::nQueueReader:
com::pcbsys::nirvana::client::nQueueAsyncReader com::pcbsys::nirvana::client::nQueueSyncReader com::pcbsys::nirvana::client::nQueueAsyncTransactionReader com::pcbsys::nirvana::client::nQueueSyncTransactionReader

Public Member Functions

virtual void close ()=0
 Close the subscription, and notify the server.
 
virtual void closeLocally ()=0
 Close the subscription, but do not notify the server.
 
void destroyReader ()
 This call will release any outstanding resources on the server and close the reader. More...
 
void destroyReaderLocally ()
 This call will close local reader resources but remain subscribed at the server Any future calls to this object will work unless destroyReader() is called. More...
 
bool hasConsumedEvents ()
 Method to see whether the reader has consumed any events. More...
 
bool isClosed ()
 When a reader is closed, the physical subscription is closed at the server. More...
 
bool isClosedLocally ()
 A reader can be closed, but the physical subscription queue is not closed at the server. More...
 
nConsumeEvent ** peek (nQueuePeekContext *pContext, int &nEvent)
 Performs a non destructive read. More...
 

Static Public Member Functions

static nQueuePeekContextcreateContext (int windowSize=0, const std::string &selector="")
 Creates a Queue Peek Context, which is used to traverse the queue. More...
 

Protected Member Functions

 nQueueReader (nQueue *pQueue, nQueueReaderContext *pContext)
 Creates a reader for the specified queue using the given reader context. The reader will have its reader unique ID assigned implicitly. More...
 
 nQueueReader (nQueue *pQueue, nQueueReaderContext *pContext, longlong readerUniqueId)
 Creates a reader for the specified queue using the given reader context and reader unique identifier. Note: This constructor must only be used for asynchronous readers, which require special reader ID assignment, for all other cases use the constructor which implicitly assigns the reader unique identifier. More...
 

Protected Attributes

longlong m_readerUniqueId
 An identifier that uniquely identifies the reader which performs this queue operation within the session. This will be paired with the connection id to uniquely identify the reader within the Universal Messaging server. Note: This should be considered final, it must be set during reader creation and not modified afterwards. More...
 

Detailed Description

This class is the base class for all Queue Readers and provides a generic reader interface.

Constructor & Destructor Documentation

com::pcbsys::nirvana::client::nQueueReader::nQueueReader ( nQueue pQueue,
nQueueReaderContext pContext 
)
protected

Creates a reader for the specified queue using the given reader context. The reader will have its reader unique ID assigned implicitly.

Parameters
pQueueThe queue to create reader for. Must not be null.
pContextThe reader context to use
com::pcbsys::nirvana::client::nQueueReader::nQueueReader ( nQueue pQueue,
nQueueReaderContext pContext,
longlong  readerUniqueId 
)
protected

Creates a reader for the specified queue using the given reader context and reader unique identifier. Note: This constructor must only be used for asynchronous readers, which require special reader ID assignment, for all other cases use the constructor which implicitly assigns the reader unique identifier.

Parameters
pQueueThe queue to create reader for.
pContextThe reader context to use.
readerUniqueIdThe reader unique identifier to use for this reader.

Member Function Documentation

static nQueuePeekContext* com::pcbsys::nirvana::client::nQueueReader::createContext ( int  windowSize = 0,
const std::string &  selector = "" 
)
static

Creates a Queue Peek Context, which is used to traverse the queue.

Parameters
windowSizeThe size of the window over the queue to uses
selectorA message selector to be applied on the events received
Returns
A new nQueuePeekContext
void com::pcbsys::nirvana::client::nQueueReader::destroyReader ( )

This call will release any outstanding resources on the server and close the reader.

Any future calls to this object will result in an nIllegalStateException being raised.

Exceptions
nUnexpectedResponseExceptionif the server returns a response that was not expected
nSessionNotConnectedExceptionif the session is currently not connected to the server
nRequestTimedOutExceptionif the request did not receive a response within the timeout period
nSessionPausedExceptionThe session is currently paused
void com::pcbsys::nirvana::client::nQueueReader::destroyReaderLocally ( )

This call will close local reader resources but remain subscribed at the server Any future calls to this object will work unless destroyReader() is called.

Exceptions
nUnexpectedResponseExceptionif the server returns a response that was not expected
nSessionNotConnectedExceptionif the session is currently not connected to the server
nRequestTimedOutExceptionif the request did not receive a response within the timeout period
bool com::pcbsys::nirvana::client::nQueueReader::hasConsumedEvents ( )

Method to see whether the reader has consumed any events.

For transactional readers, this is reset every time commit or rollback is called.

Returns
true if any events have been consumed by the reader
bool com::pcbsys::nirvana::client::nQueueReader::isClosed ( )

When a reader is closed, the physical subscription is closed at the server.

For Transactional readers, a close will rollback to the last committed event.

Returns
true if the reader has been closed
bool com::pcbsys::nirvana::client::nQueueReader::isClosedLocally ( )

A reader can be closed, but the physical subscription queue is not closed at the server.

For Transactional readers, a local close will not rollback to the last committed event.

Returns
true if the reader has been closed locally but not at the server
nConsumeEvent** com::pcbsys::nirvana::client::nQueueReader::peek ( nQueuePeekContext pContext,
int &  nEvent 
)

Performs a non destructive read.

Parameters
*pContextPeek Context to use. Used when multiple calls required to traverse a queue
nEventthe length of the array
Returns
An Array of events
Exceptions
nSecurityExceptionIf the client is not authorized to perform this request
nChannelNotFoundExceptionThe queue was not found
nSessionNotConnectedExceptionClient is not currently connected to the server
nRequestTimedOutExceptionThe server did not respond within the timeout
nUnexpectedResponseExceptionThe server responded with an unexpected response
nIllegalArgumentExceptionInvalid parameters passed
nSessionPausedExceptionThe session is currently paused, please resume
nIllegalStateExceptionThe operation could not complete because of a session/connection error

Field Documentation

longlong com::pcbsys::nirvana::client::nQueueReader::m_readerUniqueId
protected

An identifier that uniquely identifies the reader which performs this queue operation within the session. This will be paired with the connection id to uniquely identify the reader within the Universal Messaging server. Note: This should be considered final, it must be set during reader creation and not modified afterwards.