com.pcbsys.nirvana.client.nQueueSyncReader Class Reference

This class provides the client with an synchronous interface into a Nirvana Queue. More...

Inheritance diagram for com.pcbsys.nirvana.client.nQueueSyncReader:
com.pcbsys.nirvana.client.nQueueReader com.pcbsys.nirvana.client.nQueueSyncTransactionReader

Public Member Functions

String getReaderId () throws nSessionNotConnectedException
 Returns the server side unique id of the reader. More...
 
boolean hasEventsCached () throws nIllegalStateException
 This method can only return true in multi-connection environments. More...
 
final nConsumeEvent pop () throws nSessionNotConnectedException, nSessionPausedException, nSecurityException, nIllegalStateException
 This method places the client on the queue and will block until an event is placed onto the queue. More...
 
final nConsumeEvent pop (final long timeout) throws nSessionNotConnectedException, nSessionPausedException, nSecurityException, nIllegalStateException
 This method places the client on the queue and will block until an event is placed onto the queue or the specified timeout expires. More...
 
nConsumeEvent pop (final long timeout, final String selector) throws nSessionNotConnectedException, nSessionPausedException, nSecurityException, nIllegalStateException
 This method places the client on the queue and will block until an event is placed onto the queue or the specified timeout expires. More...
 
List< nConsumeEventpopEvents (int prefetchSize) throws nSessionNotConnectedException, nSessionPausedException, nSecurityException, nIllegalStateException, nIllegalArgumentException
 This method places the client on the queue and will block until an event is placed onto the queue or the specified timeout expires. More...
 
List< nConsumeEventpopEvents (int prefetchSize, long timeout) throws nSessionNotConnectedException, nSessionPausedException, nSecurityException, nIllegalStateException, nIllegalArgumentException
 This method places the client on the queue and will block until an event is placed onto the queue or the specified timeout expires. More...
 
List< nConsumeEventpopEvents (int prefetchSize, long timeout, String selector) throws nSessionNotConnectedException, nSessionPausedException, nSecurityException, nIllegalStateException, nIllegalArgumentException
 This method places the client on the queue and will block until an event is placed onto the queue or the specified timeout expires. More...
 
int receiveCacheReturnOutstandingRequests (List< nConsumeEvent > cacheList) throws nIllegalStateException
 This method will return the number of outstanding pop client requests, sent to the server, while also filling up the provided list with all the client-side cached events. More...
 
- Public Member Functions inherited from com.pcbsys.nirvana.client.nQueueReader
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...
 
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...
 

Protected Member Functions

void close () throws nSessionPausedException, nSessionNotConnectedException, nRequestTimedOutException
 Closing the reader releases resources held by the server for this subscription. More...
 
int getWindowSize ()
 The window size is irrelevant for synchronous readers. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from com.pcbsys.nirvana.client.nQueueReader
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 inherited from com.pcbsys.nirvana.client.nQueueReader
final int myUniqueReaderId
 The unique id of this nQueueReader instance. More...
 

Detailed Description

This class provides the client with an synchronous interface into a Nirvana Queue.

Events will only be delivered to this client when a call to pop is made.

Member Function Documentation

void com.pcbsys.nirvana.client.nQueueSyncReader.close ( ) throws nSessionPausedException, nSessionNotConnectedException, nRequestTimedOutException
protectedvirtual

Closing the reader releases resources held by the server for this subscription.

For a transactional reader it also rolls back any uncommitted events

Implements com.pcbsys.nirvana.client.nQueueReader.

Reimplemented in com.pcbsys.nirvana.client.nQueueSyncTransactionReader.

String com.pcbsys.nirvana.client.nQueueSyncReader.getReaderId ( ) throws nSessionNotConnectedException
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.

Implements com.pcbsys.nirvana.client.nQueueReader.

int com.pcbsys.nirvana.client.nQueueSyncReader.getWindowSize ( )
protected

The window size is irrelevant for synchronous readers.

Returns
0
boolean com.pcbsys.nirvana.client.nQueueSyncReader.hasEventsCached ( ) throws nIllegalStateException

This method can only return true in multi-connection environments.

Returns
true if the event layer has cached events, false if not.
Exceptions
nIllegalStateExceptionif the reader is closed
final nConsumeEvent com.pcbsys.nirvana.client.nQueueSyncReader.pop ( ) throws nSessionNotConnectedException, nSessionPausedException, nSecurityException, nIllegalStateException

This method places the client on the queue and will block until an event is placed onto the queue.

Returns
The popped event
Exceptions
nSessionNotConnectedExceptionClient is not currently connected to the server
nSecurityExceptionIf your not authorized to perform the operation on the queue
nSessionPausedExceptionThe session is currently paused
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.
Deprecated:
As of 10.7 this has been deprecated in favor of popEvents(int). Calling this method is equivalent to and is calling internally popEvents(1).
final nConsumeEvent com.pcbsys.nirvana.client.nQueueSyncReader.pop ( final long  timeout) throws nSessionNotConnectedException, nSessionPausedException, nSecurityException, nIllegalStateException

This method places the client on the queue and will block until an event is placed onto the queue or the specified timeout expires.

If the timeout expires it will return null

Parameters
timeoutTime to wait in milliseconds for an event
Returns
The popped event or null if the timeout expired
Exceptions
nSessionNotConnectedExceptionClient is not currently connected to the server
nSecurityExceptionIf your not authorized to perform the operation on the queue
nSessionPausedExceptionThe session is currently paused
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.
Deprecated:
As of 10.7 this has been deprecated in favor of popEvents(int, long). Calling this method is equivalent to and is calling internally popEvents(1, timeout).
nConsumeEvent com.pcbsys.nirvana.client.nQueueSyncReader.pop ( final long  timeout,
final String  selector 
) throws nSessionNotConnectedException, nSessionPausedException, nSecurityException, nIllegalStateException

This method places the client on the queue and will block until an event is placed onto the queue or the specified timeout expires.

Parameters
timeoutTime to wait in milliseconds for an event
selectorthe selection string used to filter events being popped
Returns
The popped events or null if the timeout expired
Exceptions
nSessionNotConnectedExceptionClient is not currently connected to the server
nSecurityExceptionIf your not authorized to perform the operation on the queue
nSessionPausedExceptionThe session is currently paused
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.
Deprecated:
As of 10.7 this has been deprecated in favor of popEvents(int, long, String). Calling this method is equivalent to and is calling internally popEvents(1, timeout, selector).
List<nConsumeEvent> com.pcbsys.nirvana.client.nQueueSyncReader.popEvents ( int  prefetchSize) throws nSessionNotConnectedException, nSessionPausedException, nSecurityException, nIllegalStateException, nIllegalArgumentException

This method places the client on the queue and will block until an event is placed onto the queue or the specified timeout expires.

Parameters
prefetchSizethe number of events being popped
Returns
The popped events or null if the timeout expired
Exceptions
nSessionNotConnectedExceptionClient is not currently connected to the server
nSecurityExceptionIf your not authorized to perform the operation on the queue
nSessionPausedExceptionThe session is currently paused
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.
nIllegalArgumentExceptionThis exception is raised if prefetchSize is less than 1.
Since
10.7
List<nConsumeEvent> com.pcbsys.nirvana.client.nQueueSyncReader.popEvents ( int  prefetchSize,
long  timeout 
) throws nSessionNotConnectedException, nSessionPausedException, nSecurityException, nIllegalStateException, nIllegalArgumentException

This method places the client on the queue and will block until an event is placed onto the queue or the specified timeout expires.

If the timeout expires it will return null

Parameters
prefetchSizethe number of events being popped
timeoutTime to wait in milliseconds for an event
Returns
The popped events or null if the timeout expired
Exceptions
nSessionNotConnectedExceptionClient is not currently connected to the server
nSecurityExceptionIf your not authorized to perform the operation on the queue
nSessionPausedExceptionThe session is currently paused
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.
nIllegalArgumentExceptionThis exception is raised if prefetchSize is less than 1.
Since
10.7
List<nConsumeEvent> com.pcbsys.nirvana.client.nQueueSyncReader.popEvents ( int  prefetchSize,
long  timeout,
String  selector 
) throws nSessionNotConnectedException, nSessionPausedException, nSecurityException, nIllegalStateException, nIllegalArgumentException

This method places the client on the queue and will block until an event is placed onto the queue or the specified timeout expires.

If the timeout expires it will return null

Parameters
prefetchSizethe number of events being popped
timeoutTime to wait in milliseconds for an event
selectorthe selection string used to filter events being popped
Returns
The popped events or null if the timeout expired
Exceptions
nSessionNotConnectedExceptionClient is not currently connected to the server
nSecurityExceptionIf your not authorized to perform the operation on the queue
nSessionPausedExceptionThe session is currently paused
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.
nIllegalArgumentExceptionThis exception is raised if prefetchSize is less than 0.
Since
10.7
int com.pcbsys.nirvana.client.nQueueSyncReader.receiveCacheReturnOutstandingRequests ( List< nConsumeEvent cacheList) throws nIllegalStateException

This method will return the number of outstanding pop client requests, sent to the server, while also filling up the provided list with all the client-side cached events.

If the provided list is null, no cached events will be extracted. Calling this method only makes sense in horizontal scalability landscape. When queue sync reader tries to get an event, then a pop request is sent to all of the nodes in the HS landscape. Outstanding are those requests, for which the client is still waiting for the response.

Parameters
cacheListthe list, which will be filled up with all the cached events
Returns
number of outstanding queue pop client requests
Exceptions
nIllegalStateExceptionif the reader is closed