com.pcbsys.nirvana.client.nQueueReaderContext Class Reference

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...
 

Detailed Description

This class is used to construct a Queue Reader.

Constructor & Destructor Documentation

com.pcbsys.nirvana.client.nQueueReaderContext.nQueueReaderContext ( final String  selector)

This constructor supports a standard synchronous queue reader with the message selector applied.

Parameters
selectorMessage 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.

Parameters
selectorMessage selector to be applied to the events prior to being delivered to the client
timeoutthe 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.

Parameters
aListenerAsynchronous 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.

Parameters
aListenerAsynchronous callback object
windowSizeNumber 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.

Parameters
aListenerAsynchronous callback object
selectorMessage 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.

Parameters
aListenerAsynchronous callback object
selectorMessage selector to be applied to the events prior to being delivered to the client
windowSizeNumber 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.

Parameters
aListenerAsynchronous callback object
selectorMessage selector to be applied to the events prior to being delivered to the client
windowSizeNumber of events that the server will deliver prior to expecting a commit or rollback
timeoutthe 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.

Parameters
aListenerAsynchronous callback object
aValidatora 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.

Parameters
aListenerAsynchronous callback object
aValidatora nMessageValidator which will check the signature of the incomming events
windowSizeNumber 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.

Parameters
aListenerAsynchronous callback object
aValidatora nMessageValidator which will check the signature of the incomming events
selectorMessage 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.

Parameters
aListenerAsynchronous callback object
aValidatora nMessageValidator which will check the signature of the incomming events
selectorMessage selector to be applied to the events prior to being delivered to the client
windowSizeNumber 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.

Parameters
aListenerAsynchronous callback object
aValidatora nMessageValidator which will check the signature of the incomming events
selectorMessage selector to be applied to the events prior to being delivered to the client
windowSizeNumber of events that the server will deliver prior to expecting a commit or rollback
maintainPrioritywhether 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.

Parameters
aListenerAsynchronous callback object
aValidatora nMessageValidator which will check the signature of the incomming events
selectorMessage selector to be applied to the events prior to being delivered to the client
windowSizeNumber of events that the server will deliver prior to expecting a commit or rollback
maintainPrioritywhether priority for queue readers is maintained, ie, only 1 reader consumes events until removed, when the next takes over etc
timeoutthe length of time (milliseconds) a commit or rollback will be attempted for after failure, <0 = infinite, 0 = once, >0 = retry for this period

Member Function Documentation

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.

Returns
true if the priority flag is set
nEventListener com.pcbsys.nirvana.client.nQueueReaderContext.getListener ( )

Returns the current event listener being used.

Returns
current listener
int com.pcbsys.nirvana.client.nQueueReaderContext.getPeekBatchSize ( )

Returns the current peek batch size, used only for synchronous queue readers.

Returns
int the number of events per pop taken in a batch
Since
9.9
String com.pcbsys.nirvana.client.nQueueReaderContext.getSelector ( )

Returns the current selector that this context was constructed with, could be null.

Returns
Message Selector
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

Returns
current timeout value
nMessageValidator com.pcbsys.nirvana.client.nQueueReaderContext.getValidator ( )

Retrieves the current message validator.

This could be null.

Returns
Message Validator
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.

Returns
current window size
boolean com.pcbsys.nirvana.client.nQueueReaderContext.isInfiniteWindow ( )

Checks whether there is a window size restriction for transactional queue consumers.

Returns
True if there is no 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

Parameters
isInfiniteWindowthe 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.

Parameters
listenerEvent 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.

Parameters
flagset the priority flag
void com.pcbsys.nirvana.client.nQueueReaderContext.setPeekBatchSize ( int  peekBatchSize)

Sets the current peek batch size, used only for synchronous queue readers.

Parameters
peekBatchSizethe number of events to fetch when doing a pop
Since
9.9
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

Parameters
selectora 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

Parameters
timeoutthe 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.

Parameters
validatorThe message validator to use.
void com.pcbsys.nirvana.client.nQueueReaderContext.setWindow ( final int  window)

Sets the window size.

If the asynchronous reader is constructed prior to this method then it will not take effect on that reader. For Synchronous it only has effect on com.pcbsys.nirvana.client.nQueueSyncTransactionReader

Parameters
windowthe window size to use