- com
- pcbsys
- nirvana
- client
- nQueueReaderContext
This class is used to construct a Queue Reader. More...
Public Member Functions | |
boolean | canMaintainPriority () |
Return whether the priority assignment for queue receivers is enabled. More... | |
nEventListener | getListener () |
Returns the current event listener being used. More... | |
int | getPeekBatchSize () |
Returns the current peek batch size, used only for synchronous queue readers. More... | |
String | getSelector () |
Returns the current selector that this context was constructed with, could be null. More... | |
long | getTimeout () |
Retrieves the current timeout (milliseconds) for any transactional operations, i.e. More... | |
nMessageValidator | getValidator () |
Retrieves the current message validator. More... | |
int | getWindow () |
Retrieves the current window size. More... | |
boolean | isInfiniteWindow () |
Checks whether there is a window size restriction for transactional queue consumers. More... | |
nQueueReaderContext () | |
Default constructor, useful for creating a standard synchronous queue reader. | |
nQueueReaderContext (final String selector) | |
This constructor supports a standard synchronous queue reader with the message selector applied. More... | |
nQueueReaderContext (final String selector, long timeout) | |
This constructor supports a standard synchronous queue reader with the message selector applied, and a timeout. More... | |
nQueueReaderContext (final nEventListener aListener) | |
This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored. More... | |
nQueueReaderContext (final nEventListener aListener, final int windowSize) | |
This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored. More... | |
nQueueReaderContext (final nEventListener aListener, final String selector) | |
This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored. More... | |
nQueueReaderContext (final nEventListener aListener, final String selector, final int windowSize) | |
This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored. More... | |
nQueueReaderContext (final nEventListener aListener, final String selector, final int windowSize, final long timeout) | |
This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored. More... | |
nQueueReaderContext (final nSignedEventListener aListener, final nMessageValidator aValidator) | |
This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored. More... | |
nQueueReaderContext (final nSignedEventListener aListener, final nMessageValidator aValidator, final int windowSize) | |
This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored. More... | |
nQueueReaderContext (final nSignedEventListener aListener, final nMessageValidator aValidator, final String selector) | |
This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored. More... | |
nQueueReaderContext (final nSignedEventListener aListener, final nMessageValidator aValidator, final String selector, final int windowSize) | |
This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored. More... | |
nQueueReaderContext (final nSignedEventListener aListener, final nMessageValidator aValidator, final String selector, final int windowSize, boolean maintainPriority) | |
This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored. More... | |
nQueueReaderContext (final nSignedEventListener aListener, final nMessageValidator aValidator, final String selector, final int windowSize, boolean maintainPriority, long timeout) | |
This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored. More... | |
void | setInfiniteWindow (boolean isInfiniteWindow) |
If parameter is true, removes the window size restriction for transactional queue consumers. More... | |
void | setListener (final nEventListener listener) |
Sets the current listener. More... | |
void | setMaintainPriority (boolean flag) |
Enables the priority assignment for queue receivers which enables multiple queue readers to be connected to a queue, but only one reader will consume the events at a time. More... | |
void | setPeekBatchSize (int peekBatchSize) |
Sets the current peek batch size, used only for synchronous queue readers. More... | |
void | setSelector (final String selector) |
Sets the message selector. More... | |
void | setTimeout (final long timeout) |
Sets the current timeout (milliseconds) for any transactional operations, i.e. More... | |
void | setValidator (final nMessageValidator validator) |
Sets the current message validator. More... | |
void | setWindow (final int window) |
Sets the window size. More... | |
This class is used to construct a Queue Reader.
com.pcbsys.nirvana.client.nQueueReaderContext.nQueueReaderContext | ( | final String | selector | ) |
This constructor supports a standard synchronous queue reader with the message selector applied.
selector | Message selector to be applied to the events prior to being delivered to the client |
com.pcbsys.nirvana.client.nQueueReaderContext.nQueueReaderContext | ( | final String | selector, |
long | timeout | ||
) |
This constructor supports a standard synchronous queue reader with the message selector applied, and a timeout.
selector | Message selector to be applied to the events prior to being delivered to the client |
timeout | the length of time (milliseconds) a commit or rollback will be attempted for after failure, <0 = infintite, 0 = once, >0 = retry for this period |
com.pcbsys.nirvana.client.nQueueReaderContext.nQueueReaderContext | ( | final nEventListener | aListener | ) |
This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored.
When applied as an asynchronous queue reader the window size will default to 10.
aListener | Asynchronous callback object |
com.pcbsys.nirvana.client.nQueueReaderContext.nQueueReaderContext | ( | final nEventListener | aListener, |
final int | windowSize | ||
) |
This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored.
aListener | Asynchronous callback object |
windowSize | Number of events that the server will deliver prior to expecting a commit or rollback |
com.pcbsys.nirvana.client.nQueueReaderContext.nQueueReaderContext | ( | final nEventListener | aListener, |
final String | selector | ||
) |
This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored.
The message selector will be applied to all events prior to being delivered to the client from the server.
aListener | Asynchronous callback object |
selector | Message selector to be applied to the events prior to being delivered to the client |
com.pcbsys.nirvana.client.nQueueReaderContext.nQueueReaderContext | ( | final nEventListener | aListener, |
final String | selector, | ||
final int | windowSize | ||
) |
This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored.
The message selector will be applied to all events prior to being delivered to the client from the server.
aListener | Asynchronous callback object |
selector | Message selector to be applied to the events prior to being delivered to the client |
windowSize | Number of events that the server will deliver prior to expecting a commit or rollback |
com.pcbsys.nirvana.client.nQueueReaderContext.nQueueReaderContext | ( | final nEventListener | aListener, |
final String | selector, | ||
final int | windowSize, | ||
final long | timeout | ||
) |
This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored.
The message selector will be applied to all events prior to being delivered to the client from the server.
aListener | Asynchronous callback object |
selector | Message selector to be applied to the events prior to being delivered to the client |
windowSize | Number of events that the server will deliver prior to expecting a commit or rollback |
timeout | the length of time (milliseconds) a commit or rollback will be attempted for after failure, <0 = infintite, 0 = once, >0 = retry for this period |
com.pcbsys.nirvana.client.nQueueReaderContext.nQueueReaderContext | ( | final nSignedEventListener | aListener, |
final nMessageValidator | aValidator | ||
) |
This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored.
aListener | Asynchronous callback object |
aValidator | a nMessageValidator which will check the signature of the incomming events |
com.pcbsys.nirvana.client.nQueueReaderContext.nQueueReaderContext | ( | final nSignedEventListener | aListener, |
final nMessageValidator | aValidator, | ||
final int | windowSize | ||
) |
This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored.
aListener | Asynchronous callback object |
aValidator | a nMessageValidator which will check the signature of the incomming events |
windowSize | Number of events that the server will deliver prior to expecting a commit or rollback |
com.pcbsys.nirvana.client.nQueueReaderContext.nQueueReaderContext | ( | final nSignedEventListener | aListener, |
final nMessageValidator | aValidator, | ||
final String | selector | ||
) |
This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored.
aListener | Asynchronous callback object |
aValidator | a nMessageValidator which will check the signature of the incomming events |
selector | Message selector to be applied to the events prior to being delivered to the client |
com.pcbsys.nirvana.client.nQueueReaderContext.nQueueReaderContext | ( | final nSignedEventListener | aListener, |
final nMessageValidator | aValidator, | ||
final String | selector, | ||
final int | windowSize | ||
) |
This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored.
aListener | Asynchronous callback object |
aValidator | a nMessageValidator which will check the signature of the incomming events |
selector | Message selector to be applied to the events prior to being delivered to the client |
windowSize | Number of events that the server will deliver prior to expecting a commit or rollback |
com.pcbsys.nirvana.client.nQueueReaderContext.nQueueReaderContext | ( | final nSignedEventListener | aListener, |
final nMessageValidator | aValidator, | ||
final String | selector, | ||
final int | windowSize, | ||
boolean | maintainPriority | ||
) |
This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored.
aListener | Asynchronous callback object |
aValidator | a nMessageValidator which will check the signature of the incomming events |
selector | Message selector to be applied to the events prior to being delivered to the client |
windowSize | Number of events that the server will deliver prior to expecting a commit or rollback |
maintainPriority | whether priority for queue readers is maintained, ie, only 1 reader consumes events until removed, when the next takes over etc |
com.pcbsys.nirvana.client.nQueueReaderContext.nQueueReaderContext | ( | final nSignedEventListener | aListener, |
final nMessageValidator | aValidator, | ||
final String | selector, | ||
final int | windowSize, | ||
boolean | maintainPriority, | ||
long | timeout | ||
) |
This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored.
aListener | Asynchronous callback object |
aValidator | a nMessageValidator which will check the signature of the incomming events |
selector | Message selector to be applied to the events prior to being delivered to the client |
windowSize | Number of events that the server will deliver prior to expecting a commit or rollback |
maintainPriority | whether priority for queue readers is maintained, ie, only 1 reader consumes events until removed, when the next takes over etc |
timeout | the length of time (milliseconds) a commit or rollback will be attempted for after failure, <0 = infintite, 0 = once, >0 = retry for this period |
boolean com.pcbsys.nirvana.client.nQueueReaderContext.canMaintainPriority | ( | ) |
Return whether the priority assignment for queue receivers is enabled.
If so, multiple queue readers can be connected to a queue, but only one reader will consume the events at a time. The first reader will have priority, until the reader is removed, at which time the next reader will take over.
nEventListener com.pcbsys.nirvana.client.nQueueReaderContext.getListener | ( | ) |
Returns the current event listener being used.
int com.pcbsys.nirvana.client.nQueueReaderContext.getPeekBatchSize | ( | ) |
Returns the current peek batch size, used only for synchronous queue readers.
String com.pcbsys.nirvana.client.nQueueReaderContext.getSelector | ( | ) |
Returns the current selector that this context was constructed with, could be null.
long com.pcbsys.nirvana.client.nQueueReaderContext.getTimeout | ( | ) |
Retrieves the current timeout (milliseconds) for any transactional operations, i.e.
commit / rollback of events. If the timeout is set to 0, if the operation fails, an exception will be thrown. If the timeout is <0, the commit / rollback will be retried if it fails, until it succeeds. If >0 =, upon failure, the commit / rollback will be retried until the timeout period is reached
nMessageValidator com.pcbsys.nirvana.client.nQueueReaderContext.getValidator | ( | ) |
Retrieves the current message validator.
This could be null.
int com.pcbsys.nirvana.client.nQueueReaderContext.getWindow | ( | ) |
Retrieves the current window size.
This is the number of events the server will send prior to expecting an rollback
or a commit
. No more events will be sent when this number is reached an no call is made.
boolean com.pcbsys.nirvana.client.nQueueReaderContext.isInfiniteWindow | ( | ) |
Checks whether there is a window size restriction for transactional queue consumers.
void com.pcbsys.nirvana.client.nQueueReaderContext.setInfiniteWindow | ( | boolean | isInfiniteWindow | ) |
If parameter is true, removes the window size restriction for transactional queue consumers.
This means that a consumer can consume any number of messages before committing or rolling back a transaction Note: Until the transaction is committed, these events remain on the server. So it is important to ensure that events are committed if you use this API
isInfiniteWindow | the boolean parameter to set of adding/removing windows size restriction |
void com.pcbsys.nirvana.client.nQueueReaderContext.setListener | ( | final nEventListener | listener | ) |
Sets the current listener.
This has no effect if the reader has been created prior to calling this method. The reader will need to be destoryed and recreated.
listener | Event listener. |
void com.pcbsys.nirvana.client.nQueueReaderContext.setMaintainPriority | ( | boolean | flag | ) |
Enables the priority assignment for queue receivers which enables multiple queue readers to be connected to a queue, but only one reader will consume the events at a time.
So the first reader will have priority, until the reader is removed, at which time the next reader will take over.
flag | set the priority flag |
void com.pcbsys.nirvana.client.nQueueReaderContext.setPeekBatchSize | ( | int | peekBatchSize | ) |
Sets the current peek batch size, used only for synchronous queue readers.
peekBatchSize | the number of events to fetch when doing a pop |
void com.pcbsys.nirvana.client.nQueueReaderContext.setSelector | ( | final String | selector | ) |
Sets the message selector.
If the reader has already been created this method does nothing. If the reader is an asynchronous queue reader then the existing reader must be destroyed and recreated before this selector will take effect else the next pop
will take this into account
selector | a Message selector |
void com.pcbsys.nirvana.client.nQueueReaderContext.setTimeout | ( | final long | timeout | ) |
Sets the current timeout (milliseconds) for any transactional operations, i.e.
commit / rollback of events. If the timeout is set to 0, if the operation fails, an exception will be thrown. If the timeout is <0, the commit / rollback will be retried if it fails, until it succeeds. If >0 =, upon failure, the commit / rollback will be retried until the timeout period is reached
timeout | the timeout for transactional operations |
void com.pcbsys.nirvana.client.nQueueReaderContext.setValidator | ( | final nMessageValidator | validator | ) |
Sets the current message validator.
It has no effect if the reader is an asynchronous queue reader and the reader will need to be destoryed and recreated prior to this taking effect. If the reader is an synchronous queue reader the next event popped will use the message validator.
validator | The message validator to use. |
void com.pcbsys.nirvana.client.nQueueReaderContext.setWindow | ( | final int | window | ) |
Sets the window size.
This function has no effect on synchronous readers and if the asynchronous reader is constructed prior to this method then it will not take effect until the reader is destoryed and recreated.
window | the window size to use |