com.pcbsys.nirvana.client.nQueueReader Class Referenceabstract

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

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

void destroyReader () throws nUnexpectedResponseException, nSessionPausedException, nSessionNotConnectedException, nRequestTimedOutException
 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...
 
abstract String getReaderId () throws nSessionNotConnectedException
 Returns the server side unique id of the reader. More...
 
int getUniqueReaderId ()
 Returns the id of the nQueueReader instance which is automatically set on reader creation and sent to the server with each nPopQueue operation. More...
 
boolean hasConsumedEvents ()
 Method to see whether the reader has consumed any events. More...
 
boolean isClosed ()
 When a reader is closed, the physical subscription is closed at the server. More...
 
boolean isClosedLocally ()
 A reader can be closed, but the physical subscription queue is not closed at the server. More...
 
final nConsumeEvent[] peek (final nQueuePeekContext context) throws nSecurityException, nChannelNotFoundException, nSessionNotConnectedException, nRequestTimedOutException, nUnexpectedResponseException, nSessionPausedException, nIllegalArgumentException, nIllegalStateException
 Performs a non destructive read. More...
 

Static Public Member Functions

static nQueuePeekContext createContext ()
 Creates a Queue Peek Context, which is used to traverse the queue. More...
 
static nQueuePeekContext createContext (final int windowSize)
 Creates a Queue Peek Context, which is used to traverse the queue. More...
 
static nQueuePeekContext createContext (final int windowSize, final String selector)
 Creates a Queue Peek Context, which is used to traverse the queue. More...
 

Protected Attributes

final int myUniqueReaderId
 The unique id of this nQueueReader instance. More...
 

Detailed Description

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

Member Function Documentation

static nQueuePeekContext com.pcbsys.nirvana.client.nQueueReader.createContext ( )
static

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

Returns
A new nQueuePeekContext
static nQueuePeekContext com.pcbsys.nirvana.client.nQueueReader.createContext ( final int  windowSize)
static

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

Parameters
windowSizeThe size of the window over the queue to uses
Returns
A new nQueuePeekContext
static nQueuePeekContext com.pcbsys.nirvana.client.nQueueReader.createContext ( final int  windowSize,
final 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 ( ) throws nUnexpectedResponseException, nSessionPausedException, nSessionNotConnectedException, nRequestTimedOutException

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
abstract String com.pcbsys.nirvana.client.nQueueReader.getReaderId ( ) throws nSessionNotConnectedException
pure virtual

Returns the server side unique id of the reader.

This ID can change after subscriber reconnect.

Returns
the unique reader id
Exceptions
nSessionNotConnectedException- if the session is not currently connected to the server.

Implemented in com.pcbsys.nirvana.client.nQueueSyncReader, and com.pcbsys.nirvana.client.nQueueAsyncReader.

int com.pcbsys.nirvana.client.nQueueReader.getUniqueReaderId ( )

Returns the id of the nQueueReader instance which is automatically set on reader creation and sent to the server with each nPopQueue operation.

Returns
the unique reader id
boolean 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
boolean 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
boolean 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

Performs a non destructive read.

Parameters
contextPeek Context to use. Used when multiple calls required to travers a queue
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
nIllegalStateExceptionThis exception is raised if there is any issues with any of the arguments used by this method. One condition of this is if this object has been invalidated and no longer can be utilised, this can occur if a delete request has been issued to the connected server.

Field Documentation

final int com.pcbsys.nirvana.client.nQueueReader.myUniqueReaderId
protected

The unique id of this nQueueReader instance.

This will be set automatically when creating the reader and sent to the server with each nPopQueue operation.

See Also
nPopQueue::getReaderUniqueID()