com.pcbsys.nirvana.client.nChannelIterator Class Reference

This class iterates synchronously over a Nirvana Realm channel. More...

Inherited by com.pcbsys.nirvana.base.clientimpl.multiconnection.nChannelIteratorWrapper.

Public Member Functions

void ack (long eid) throws nSecurityException, nChannelNotFoundException, nSessionNotConnectedException, nSessionPausedException, nRequestTimedOutException, nRealmNotFoundException, nUnexpectedResponseException, nSelectorParserException
 Acknowledge an event id consumed by this iterator when not using auto ack. More...
 
synchronized void ack (long eid, boolean isIndividualAck, boolean ackPrevious) throws nSecurityException, nChannelNotFoundException, nSessionNotConnectedException, nSessionPausedException, nRequestTimedOutException, nRealmNotFoundException, nUnexpectedResponseException, nSelectorParserException
 Acknowledge an event id consumed by this iterator when not using auto ack. More...
 
synchronized void close ()
 This method will initiate a close to the server for this Iterator. More...
 
synchronized nConsumeEvent getFirst () throws nSecurityException, nChannelNotFoundException, nSessionNotConnectedException, nSessionPausedException, nRequestTimedOutException, nRealmNotFoundException, nUnexpectedResponseException, nSelectorParserException
 This returns the first event in the channel or null if there are no events in the channel. More...
 
synchronized nConsumeEvent getLast () throws nSecurityException, nChannelNotFoundException, nSessionNotConnectedException, nSessionPausedException, nRequestTimedOutException, nRealmNotFoundException, nUnexpectedResponseException, nSelectorParserException
 This returns the last event in the channel or null if there are no events in the channel. More...
 
nConsumeEvent getNext () throws nSecurityException, nChannelNotFoundException, nSessionNotConnectedException, nSessionPausedException, nRealmNotFoundException, nUnexpectedResponseException, nSelectorParserException
 Returns the next event in the channel, or will block until an event is published. More...
 
nConsumeEvent getNext (long timeout) throws nSecurityException, nChannelNotFoundException, nSessionNotConnectedException, nSessionPausedException, nRequestTimedOutException, nRealmNotFoundException, nUnexpectedResponseException, nSelectorParserException
 Returns the next event in the channel, or if none will block for the time in milliseconds for the next event to be published onto the channel. More...
 
List< nConsumeEventgetNextEvents (int prefetchSize) throws nSessionNotConnectedException, nSelectorParserException, nSessionPausedException, nUnexpectedResponseException, nRealmNotFoundException, nRequestTimedOutException, nChannelNotFoundException, nSecurityException, nIllegalArgumentException
 Returns the next batch of events available on the channel, with maximum count up to the prefetchSize value, or if none will block until an event is published. More...
 
List< nConsumeEventgetNextEvents (int prefetchSize, long timeout) throws nRequestTimedOutException, nSessionNotConnectedException, nSessionPausedException, nUnexpectedResponseException, nRealmNotFoundException, nSecurityException, nChannelNotFoundException, nSelectorParserException, nIllegalArgumentException
 Returns the next batch of events available on the channel, with maximum count up to the prefetchSize value, or if none will block for the time in milliseconds for the next event to be published onto the channel. More...
 
synchronized nConsumeEvent getPrev () throws nSecurityException, nChannelNotFoundException, nSessionNotConnectedException, nSessionPausedException, nRequestTimedOutException, nRealmNotFoundException, nUnexpectedResponseException, nSelectorParserException
 Gets the previous event in the channel or null if there are no more previous events. More...
 
boolean hasEventsCached () throws nIllegalStateException
 This method can only return true in multi-connection environments. More...
 
boolean isAutoAck ()
 Whether this iterator is set to auto acknowledge. More...
 
int receiveCacheReturnOutstandingRequests (List< nConsumeEvent > cacheList) throws nIllegalStateException
 This method will return the number of outstanding iterate client requests, sent to the server, while also filling up the provided list with all the client-side cached events. More...
 
synchronized void rollback () throws nRequestTimedOutException, nSessionPausedException, nSessionNotConnectedException, nRealmNotFoundException, nSecurityException, nUnexpectedResponseException, nChannelNotFoundException, nSelectorParserException
 If this is a shared named object, this method can be used to push any consumed messages back onto the resource on the server, ready for re-consumption. More...
 
synchronized void rollback (long eventID) throws nRequestTimedOutException, nSessionPausedException, nSessionNotConnectedException, nRealmNotFoundException, nSecurityException, nUnexpectedResponseException, nChannelNotFoundException, nSelectorParserException
 

Static Public Attributes

static final int INFINITE_WINDOW = com.pcbsys.nirvana.base.nConstants.INFINITE_WINDOW
 Used for specifying infinite window size when creating a channel iterator.
 

Protected Member Functions

void reconnect ()
 This is called to resubscribe a channel iterator after a disconnect event.
 

Detailed Description

This class iterates synchronously over a Nirvana Realm channel.

By using the methods the channel can be traversed forwards/backwards

Member Function Documentation

Acknowledge an event id consumed by this iterator when not using auto ack.

Parameters
eidthe event id to acknowledge
Exceptions
nSecurityExceptionUser is not authorised for the function
nChannelNotFoundExceptionThe channel doesn't exist
nSessionNotConnectedExceptionCurrent session is not connected
nSessionPausedExceptionThe session is currently paused, please resume
nRequestTimedOutExceptionThe server has not responded to the request in the timeout period
nRealmNotFoundExceptionThe realm is not known by the server
nUnexpectedResponseExceptionReceived a response from the server for which we can not deal with, see the message for further information. 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.
nSelectorParserExceptionThe selector has syntax errors
synchronized void com.pcbsys.nirvana.client.nChannelIterator.ack ( long  eid,
boolean  isIndividualAck,
boolean  ackPrevious 
) throws nSecurityException, nChannelNotFoundException, nSessionNotConnectedException, nSessionPausedException, nRequestTimedOutException, nRealmNotFoundException, nUnexpectedResponseException, nSelectorParserException

Acknowledge an event id consumed by this iterator when not using auto ack.

Parameters
eidthe event id to acknowledge
isIndividualAckwhether events must be acknowledge individually
ackPreviouswhether previous events must be acknowledged
Exceptions
nSecurityExceptionUser is not authorised for the function
nChannelNotFoundExceptionThe channel doesn't exist
nSessionNotConnectedExceptionCurrent session is not connected
nSessionPausedExceptionThe session is currently paused, please resume
nRequestTimedOutExceptionThe server has not responded to the request in the timeout period
nRealmNotFoundExceptionThe realm is not known by the server
nUnexpectedResponseExceptionReceived a response from the server for which we can not deal with, see the message for further information. 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.
nSelectorParserExceptionThe selector has syntax errors
synchronized void com.pcbsys.nirvana.client.nChannelIterator.close ( )

This method will initiate a close to the server for this Iterator.

Since
4.0

This returns the first event in the channel or null if there are no events in the channel.

Returns
a nConsumeEvent or null
Exceptions
nSecurityExceptionIf the client does not have the ability to subscribe to the channel
nChannelNotFoundExceptionThe channel is no longer valid
nSessionNotConnectedExceptionThe session has been disconnected
nRequestTimedOutExceptionif the time out for the event to be published is exceeded
nUnexpectedResponseExceptionReceived a response from the server for which we can not deal with, see the message for further information.

This can be thrown if this object has been invalidated and no longer can be utilised, this can occur if a delete/close request has been issued to the connected server.

This will be thrown if the iterator has been closed.

Exceptions
nSessionPausedExceptionThe session is currently paused, please resume
nSelectorParserExceptionInvalid selector specified
nRealmNotFoundExceptionThe remote realm could not be found

This returns the last event in the channel or null if there are no events in the channel.

Returns
a nConsumeEvent or null
Exceptions
nSecurityExceptionIf the client does not have the ability to subscribe to the channel
nChannelNotFoundExceptionThe channel is no longer valid
nSessionNotConnectedExceptionThe session has been disconnected
nRequestTimedOutExceptionif the time out for the event to be published is exceeded
nUnexpectedResponseExceptionReceived a response from the server for which we can not deal with, see the message for further information.

This can be thrown if this object has been invalidated and no longer can be utilised, this can occur if a delete/close request has been issued to the connected server.

This will be thrown if the iterator has been closed.

Exceptions
nSessionPausedExceptionThe session is currently paused, please resume
nSelectorParserExceptionInvalid selector specified
nRealmNotFoundExceptionThe remote realm could not be found

Returns the next event in the channel, or will block until an event is published.

Returns
a nConsumeEvent
Exceptions
nSecurityExceptionIf the client does not have the ability to subscribe to the channel
nChannelNotFoundExceptionThe channel is no longer valid
nSessionNotConnectedExceptionThe session has been disconnected
nUnexpectedResponseExceptionReceived a response from the server for which we can not deal with, see the message for further information.

This can be thrown if this object has been invalidated and no longer can be utilised, this can occur if a delete/close request has been issued to the connected server.

This will be thrown if the iterator has been closed.

Exceptions
nSessionPausedExceptionThe session is currently paused, please resume
nSelectorParserExceptionInvalid selector specified
nRealmNotFoundExceptionThe remote realm could not be found
Deprecated:
As of 10.7 this has been deprecated in favor of getNextEvents(int). Calling this method is equivalent to and is calling internally getNextEvents(1).

Returns the next event in the channel, or if none will block for the time in milliseconds for the next event to be published onto the channel.

Parameters
timeouttime in milliseconds to wait for the event. Wait indefinitely if timeout is negative.
Returns
a nConsumeEvent
Exceptions
nSecurityExceptionIf the client does not have the ability to subscribe to the channel
nChannelNotFoundExceptionThe channel is no longer valid
nSessionNotConnectedExceptionThe session has been disconnected
nRequestTimedOutExceptionif the time out for the event to be published is exceeded
nUnexpectedResponseExceptionReceived a response from the server for which we can not deal with, see the message for further information.

This can be thrown if this object has been invalidated and no longer can be utilised, this can occur if a delete/close request has been issued to the connected server.

This will be thrown if the iterator has been closed.

Exceptions
nSessionPausedExceptionThe session is currently paused, please resume
nSelectorParserExceptionInvalid selector specified
nRealmNotFoundExceptionThe remote realm could not be found
Deprecated:
As of 10.7 this has been deprecated in favor of getNextEvents(int, long). Calling this method is equivalent to and is calling internally getNextEvents(1, timeout).

Returns the next batch of events available on the channel, with maximum count up to the prefetchSize value, or if none will block until an event is published.

Parameters
prefetchSizemaximum amount of events to be delivered on a single call.
Returns
a list of nConsumeEvent events, with size based on the prefetchSize value.
Exceptions
nRequestTimedOutExceptionif the time out for the event to be published is exceeded
nSessionNotConnectedExceptionThe session has been disconnected
nSessionPausedExceptionThe session is currently paused, please resume
nUnexpectedResponseExceptionReceived a response from the server for which we can not deal with,
  • see the message for further information. 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.
nRealmNotFoundExceptionThe remote realm could not be found
nSecurityExceptionIf the client does not have the ability to subscribe to the channel
nChannelNotFoundExceptionThe channel is no longer valid
nSelectorParserExceptionInvalid selector specified
nIllegalArgumentExceptionInvalid prefetch value specified
Since
10.7

Returns the next batch of events available on the channel, with maximum count up to the prefetchSize value, or if none will block for the time in milliseconds for the next event to be published onto the channel.

Parameters
prefetchSizemaximum amount of events to be delivered on a single call.
timeouttime in milliseconds to wait for the event. Wait indefinitely if timeout is negative.
Returns
a list of nConsumeEvent events, with size based on the prefetchSize value.
Exceptions
nRequestTimedOutExceptionif the time out for the event to be published is exceeded
nSessionNotConnectedExceptionThe session has been disconnected
nSessionPausedExceptionThe session is currently paused, please resume
nUnexpectedResponseExceptionReceived a response from the server for which we can not deal with,
  • see the message for further information. 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.
nRealmNotFoundExceptionThe remote realm could not be found
nSecurityExceptionIf the client does not have the ability to subscribe to the channel
nChannelNotFoundExceptionThe channel is no longer valid
nSelectorParserExceptionInvalid selector specified
nIllegalArgumentExceptionInvalid prefetch value specified
Since
10.7

Gets the previous event in the channel or null if there are no more previous events.

Returns
a nConsumeEvent or null
Exceptions
nSecurityExceptionIf the client does not have the ability to subscribe to the channel
nChannelNotFoundExceptionThe channel is no longer valid
nSessionNotConnectedExceptionThe session has been disconnected
nRequestTimedOutExceptionif the time out for the event to be published is exceeded
nUnexpectedResponseExceptionReceived a response from the server for which we can not deal with, see the message for further information.

This can be thrown if this object has been invalidated and no longer can be utilised, this can occur if a delete/close request has been issued to the connected server.

This will be thrown if the iterator has been closed.

Exceptions
nSessionPausedExceptionThe session is currently paused, please resume
nSelectorParserExceptionInvalid selector specified
nRealmNotFoundExceptionThe remote realm could not be found
boolean com.pcbsys.nirvana.client.nChannelIterator.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 iterator is closed
boolean com.pcbsys.nirvana.client.nChannelIterator.isAutoAck ( )

Whether this iterator is set to auto acknowledge.

Returns
true if auto acknowledge
int com.pcbsys.nirvana.client.nChannelIterator.receiveCacheReturnOutstandingRequests ( List< nConsumeEvent cacheList) throws nIllegalStateException

This method will return the number of outstanding iterate 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 iterator tries to get an event, then an iterate 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 channel iterate client requests
Exceptions
nIllegalStateExceptionif the iterator is closed

If this is a shared named object, this method can be used to push any consumed messages back onto the resource on the server, ready for re-consumption.

Exceptions
nRequestTimedOutExceptionIf we do not receive a response from the server this will be thrown
nSessionPausedExceptionIf the session is paused
nSessionNotConnectedExceptionIf the session is currently disconnected
Parameters
eventIDThe event ID to Rollback events up to and including this event ID
Exceptions
nSecurityExceptionUser is not authorised for the function
nChannelNotFoundExceptionThe channel doesn't exist
nSessionNotConnectedExceptionCurrent session is not connected
nSessionPausedExceptionThe session is currently paused, please resume
nRequestTimedOutExceptionThe server has not responded to the request in the timeout period
nRealmNotFoundExceptionThe realm is not known by the server
nUnexpectedResponseExceptionReceived a response from the server for which we can not deal with, see the message for further information. 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.
nSelectorParserExceptionThe selector has syntax errors