This class provides a Queue mechanism. More...
Public Member Functions | |
void | addConnectionListener (nChannelConnectionListener listener) |
Adds a nChannelConnectionListener to this queue so that when new connections are made to this queue the listener is notified More... | |
nQueueAsyncReader | createAsyncReader (nQueueReaderContext context) |
Creates an Asynchronous queue reader. More... | |
nQueueAsyncTransactionReader | createAsyncTransactionalReader (nQueueReaderContext context) |
Creates an Asynchronous Transactional queue reader. More... | |
nQueueSyncFragmentReader | createFragmentReader (nQueueReaderContext context) |
Creates a Synchronous queue reader that supports event fragments. More... | |
nQueueSyncReader | createReader (nQueueReaderContext context) |
Creates a Synchronous queue reader. More... | |
nQueueSyncTransactionFragmentReader | createTransactionalFragmentReader (nQueueReaderContext context) |
Creates a Synchronous Transaction queue reader that supports event fragments. More... | |
nQueueSyncTransactionReader | createTransactionalReader (nQueueReaderContext context) |
Creates a Synchronous Transaction queue reader. More... | |
nQueueDetails | getDetails () |
Provides additional information about this queue object More... | |
string | getName () |
Gets the name of this queue. More... | |
nChannelAttributes | getQueueAttributes () |
This method will return the nChannelAttributes associated with the nQueue object More... | |
void | purge () |
Deletes all undelivered events from the queue. More... | |
void | purge (string selector) |
Deletes all undelivered events from the queue. More... | |
long | push (nConsumeEvent e) |
Pushes an event on to the queue. More... | |
void | removeConnectionListener (nChannelConnectionListener listener) |
Removes the connection listener to this queue More... | |
int | size () |
Returns the number of events waiting in the queue. More... | |
Public Member Functions inherited from com.pcbsys.nirvana.client.nAbstractChannel | |
int | getQueueSize () |
Returns the size of the underlying event queue waiting for delivery via the go method More... | |
nSession | getSession () |
Returns the nSession object that this channel belongs to More... | |
void | updateProtobufDefinitions (byte[][] descriptors) |
Sets the protobuf descriptors for this channel. More... | |
Static Public Member Functions | |
static void | destroyReader (nQueueReader reader) |
This call will release any outstanding resources on the server and close the reader. More... | |
static void | destroyReaderLocally (nQueueReader reader) |
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... | |
This class provides a Queue mechanism.
It allows for multiple users to pop events from the queue and multiple users to push events on to the queue.
However, a queue differs from a channel in that an event can only be popped by one user. This means that an event is only delivered to one client. While a channel it is delivered to all users who are subscribed.
The queue also offers a peek method. This method uses a window over the queue so that the entire queue does not need to be sent in one hit.
Four different Queue reading models are supported, these are
Synchronous
Here the client will call pop()
whenever the client wants to retrieve an event from the server. The server will automatically acknowledge that the client has received this event.
Synchronous Transactional
This is similar in operation to the Synchronous model, except the server does not auto acknowledge the events, this enables the client to perform commit()
or rollback()
operations.
Asynchronous
In this model the server will record that the client is interested in events from this queue and will maintain an outstanding pop()
and as events are received on the queue they are automatically delivered to the client via a callback. The events are auto acknowledged on the server once they have been delivered to the client. /para> Asynchronous Transactional
This is similar in operation to the Asynchronous model, except the server does not auto acknowledge the events, this enables the client to perform commit()
or rollback()
operations. The server will stop delivering events to this client once the WindowSize
has been reached, the client will need to call either commit()
or rollback()
before events are delivered again. /para> In both transactional models, when a rollback()
is called any events sent since the last commit()
or rollback()
will be redelivered to all registered clients. This means the client may not receive these events again, but rather, they are redistributed amongst the current clients.
void com.pcbsys.nirvana.client.nQueue.addConnectionListener | ( | nChannelConnectionListener | listener | ) |
Adds a nChannelConnectionListener to this queue so that when new connections are made to this queue the listener is notified
listener | to add |
nRequestTimedOutException | if the request exceeded the timeout value |
nSessionNotConnectedException | The session is not currently connected to the server |
nUnexpectedResponseException | Received a response from the server for which we can not deal with, see the message for further information |
nIllegalArgumentException | Passed am illegal argument. This means the value passed is outside expected limits, or has already been set. |
nSessionPausedException | The session is currently paused, please resume |
nQueueAsyncReader com.pcbsys.nirvana.client.nQueue.createAsyncReader | ( | nQueueReaderContext | context | ) |
Creates an Asynchronous queue reader.
In this model the server will record that the client is interested in events from this queue and will maintain an outstanding pop()
and as events are received on the queue they are automatically delivered to the client via a callback. The events are auto acknowledged on the server once they have been delivered to the client.
context | contains the readers context to be used during construction of the reader |
nIllegalArgumentException | if the context is null or some non specified error is found |
nSecurityException | if the subject does not have the correct permissions |
nQueueAsyncTransactionReader com.pcbsys.nirvana.client.nQueue.createAsyncTransactionalReader | ( | nQueueReaderContext | context | ) |
Creates an Asynchronous Transactional queue reader.
This is similar in operation to the Asynchronous model, except the server does not auto acknowledge the events, this enables the client to perform commit()
or rollback()
operations. The server will stop delivering events to this client once the WindowSize
has been reached, the client will need to call either commit()
or rollback()
before events are delivered again.
context | contains the readers context to be used during construction of the reader |
nIllegalArgumentException | if the context is null or some non specified error is found |
nSecurityException | if the subject does not have the correct permissions |
nQueueSyncFragmentReader com.pcbsys.nirvana.client.nQueue.createFragmentReader | ( | nQueueReaderContext | context | ) |
Creates a Synchronous queue reader that supports event fragments.
Here the client will call pop()
whenever the client wants to retrieve an event from the server. The server will automatically acknowledge that the client has received this event.
context | contains the readers context to be used during construction of the reader |
nIllegalArgumentException | if the context is null |
nQueueSyncReader com.pcbsys.nirvana.client.nQueue.createReader | ( | nQueueReaderContext | context | ) |
Creates a Synchronous queue reader.
Here the client will call pop()
whenever the client wants to retrieve an event from the server. The server will automatically acknowledge that the client has received this event.
context | contains the readers context to be used during construction of the reader |
nIllegalArgumentException | if the context is null |
nQueueSyncTransactionFragmentReader com.pcbsys.nirvana.client.nQueue.createTransactionalFragmentReader | ( | nQueueReaderContext | context | ) |
Creates a Synchronous Transaction queue reader that supports event fragments.
This is similar in operation to the Synchronous model, except the server does not auto acknowledge the events, this enables the client to perform commit()
or rollback()
operations.
context | contains the readers context to be used during construction of the reader |
nIllegalArgumentException | if the context is null |
nQueueSyncTransactionReader com.pcbsys.nirvana.client.nQueue.createTransactionalReader | ( | nQueueReaderContext | context | ) |
Creates a Synchronous Transaction queue reader.
This is similar in operation to the Synchronous model, except the server does not auto acknowledge the events, this enables the client to perform commit()
or rollback()
operations.
context | contains the readers context to be used during construction of the reader |
nIllegalArgumentException | if the context is null |
|
static |
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.
reader | The reader to close |
nUnexpectedResponseException | if the server returns a response that was not expected |
nSessionNotConnectedException | if the session is currently not connected to the server |
nRequestTimedOutException | if the request did not receive a response within the timeout period |
nSessionPausedException | The session is currently paused |
|
static |
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
reader | The reader to close |
nUnexpectedResponseException | if the server returns a response that was not expected |
nSessionNotConnectedException | if the session is currently not connected to the server |
nRequestTimedOutException | if the request did not receive a response within the timeout period |
nQueueDetails com.pcbsys.nirvana.client.nQueue.getDetails | ( | ) |
Provides additional information about this queue object
string com.pcbsys.nirvana.client.nQueue.getName | ( | ) |
Gets the name of this queue.
nChannelAttributes com.pcbsys.nirvana.client.nQueue.getQueueAttributes | ( | ) |
This method will return the nChannelAttributes associated with the nQueue object
void com.pcbsys.nirvana.client.nQueue.purge | ( | ) |
Deletes all undelivered events from the queue.
nSecurityException | The client is not authorized to perform this task |
nChannelNotFoundException | The Queue could not be found |
nSessionNotConnectedException | Client is not currently connected to the server |
nRequestTimedOutException | The server did not respond within the timeout |
nUnexpectedResponseException | The server responded with an unknown response |
nSessionPausedException | The session is currently paused |
void com.pcbsys.nirvana.client.nQueue.purge | ( | string | selector | ) |
Deletes all undelivered events from the queue.
selector | Purges all events which match this filter |
nSecurityException | The client is not authorized to perform this task |
nChannelNotFoundException | The Queue could not be found |
nSessionNotConnectedException | Client is not currently connected to the server |
nRequestTimedOutException | The server did not respond within the timeout |
nUnexpectedResponseException | The server responded with an unknown response |
nSessionPausedException | The session is currently paused |
long com.pcbsys.nirvana.client.nQueue.push | ( | nConsumeEvent | e | ) |
Pushes an event on to the queue.
e | nConsumeEvent to push |
nIllegalArgumentException | If the event is null |
nSecurityException | If your not authorized to publish to the queue |
nRequestTimedOutException | If the server failed to responded |
nSessionNotConnectedException | Client is not currently connected to the server |
nSessionPausedException | The session is currently paused |
void com.pcbsys.nirvana.client.nQueue.removeConnectionListener | ( | nChannelConnectionListener | listener | ) |
Removes the connection listener to this queue
listener | remove the listener |
nRequestTimedOutException | if the request exceeded the timeout value |
nSessionNotConnectedException | The session is not currently connected to the server |
nUnexpectedResponseException | Received a response from the server for which we can not deal with, see the message for further information |
nSessionPausedException | The session is currently paused, please resume |
int com.pcbsys.nirvana.client.nQueue.size | ( | ) |
Returns the number of events waiting in the queue.