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.
nEventListener getListener ()
 Returns the current event listener being used.
String getSelector ()
 Returns the current selector that this context was constructed with, could be null.
long getTimeout ()
 Retrieves the current timeout (milliseconds) for any transactional operations, i.e.
nMessageValidator getValidator ()
 Retrieves the current message validator.
int getWindow ()
 Retrieves the current window size.
 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.
 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.
 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.
 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.
 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.
 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.
 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.
 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.
 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.
 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.
 nQueueReaderContext (final nEventListener aListener)
 This constructor supports an asynchronous queue reader, if applied to a synchronous queue reader the listener is ignored.
 nQueueReaderContext (final String selector, long timeout)
 This constructor supports a standard synchronous queue reader with the message selector applied, and a timeout.
 nQueueReaderContext (final String selector)
 This constructor supports a standard synchronous queue reader with the message selector applied.
 nQueueReaderContext ()
 Default constructor, useful for creating a standard synchronous queue reader.
void setListener (final nEventListener listener)
 Sets the current listener.
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.
void setSelector (final String selector)
 Sets the message selector.
void setTimeout (final long timeout)
 Sets the current timeout (milliseconds) for any transactional operations, i.e.
void setValidator (final nMessageValidator validator)
 Sets the current message validator.
void setWindow (final int window)
 Sets the window size.

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

Parameters:
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 1.

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

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

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

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

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

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

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

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

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

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

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


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

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

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

Parameters:
flag set the priority flag

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

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

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

Parameters:
window the window size to use