Class EventConsumer
A class which provides the functionality of all the types of
consumers: direct, asynchronous, request. Use
HTTPFabricConnection methods to create a new consumer.
Defined in: <D:\Programs\Neeve\Projects\NeeveBuild\stjsapi/src/main/webapp/js\EventConsumer.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
EventConsumer(consumerName, listener, filter, selector, mode, eventScope, fabricConnection, fabricConnection)
Creates a consumer for consuming events raised in Fabric
|
Method Attributes | Method Name and Description |
---|---|
void |
clear()
Clears this consumer queue
|
void |
close()
Closes this consumer and removes it from the Fabric connection
|
String |
Returns the delivery mode of this consumer queue.
|
number |
Returns the delivery delay of this consumer queue
|
String |
Returns the dispatch mode of this consumer.
|
String |
Returns the event filter of this consumer.
|
EventListener |
Returns the listener of this consumer
|
String |
Returns the event scope of this consumer.
|
String |
Returns the event selector of this consumer.
|
String |
Returns the flow control mode of this consumer queue.
|
number |
Returns the maximum depth of this consumer queue
|
String |
getName()
Returns the name of this consumer
|
EventListener |
Returns the notification listener associated with the underlying queue of
this asynchronous consumer.
|
EventListener |
Returns the request listener of this consumer
|
void |
Checks either consumer started or not
|
void |
Checks either consumer resumed or not
|
void |
resume()
Resumes the consuming of events
|
void |
setDeliveryMode(mode)
Sets the delivery mode of this consumer queue.
|
void |
setDeliverySpinWait(spinWait)
Sets the delivery delay of this consumer queue
|
void |
setEventListener(listener)
Sets the listener for this consumer
|
void |
setEventSelector(selector)
Sets the event selector for this consumer.
|
void |
setFlowControlMode(mode)
Sets the flow control mode of this consumer queue.
|
void |
setMaxDepth(maxDepth)
Sets the maximum depth of this consumer queue
|
void |
setNotificationListener(listener)
Sets the notification listener associated with the underlying queue of
this asynchronous consumer.
|
void |
setRequestListener(listener)
Sets the request listener for this consumer
|
void |
start()
Starts consuming of events by this consumer
|
void |
stop()
Stops the consuming of events
|
void |
suspend()
Suspends the consuming of events
|
Class Detail
EventConsumer(consumerName, listener, filter, selector, mode, eventScope, fabricConnection, fabricConnection)
Creates a consumer for consuming events raised in Fabric
- Parameters:
- {String} consumerName
- The name of the consumer, which should be unique within Fabric
- {EventListener} listener
- The listener associated with the consumer. All the consumed events
are processed by the listener's
onEvent()
method. - {String} filter
- The event filter of the consumer. This filter is actually an event id mask, which defines what event id can have a consumed event. See HTTPFabricConnection#createEventConsumer for details.
- {String} selector
- The event selector of the consumer. Selector allows to specify almost any conditions on event properties' values which should be satisfied for an event to be consumed. See Selector for details.
- {String} mode
- The dispatch mode of the consumer which defines its type. The possible values are: 'DIRECT', 'ASYNC' and 'REQUEST'.
- {String} eventScope
- The scope of the consumer. See HTTPFabricConnection#getEventScope for possible event scope values.
- {HTTPFabricConnection} fabricConnection
- The connection for which this consumer is created.
- fabricConnection
Method Detail
clear()
Clears this consumer queue
close()
Closes this consumer and removes it from the Fabric connection
{String}
getDeliveryMode()
Returns the delivery mode of this consumer queue. It can have two
possible values:
- ASYNC: The Asynchronous delivery mode buffers events in the Event Queue and uses a delivery thread to loop thru messages one by one delivering them to the listener. In contrast to synchronous delivery asynchornous delivery increases throughput at the expense of increasing latency.
- ASYNC_PACED: Asynchronous Paced delivery mode buffers events in the Event Queue but reads blocks of events and delivers the events to the listener in a separate thread. The paced delivery mode also uses a wait/notify to force buffer flushes. The combined effect of these techniques results in reduced blocking of queue operations, thereby increasing throughput at the expense of further increasing latency.
- Returns:
- This consumer delivery mode
{number}
getDeliverySpinWait()
Returns the delivery delay of this consumer queue
- Returns:
- This consumer queue delivery delay
{String}
getDispatchMode()
Returns the dispatch mode of this consumer. The possible values are:
'DIRECT', 'ASYNC' and 'REQUEST'. See
HTTPFabricConnection#createEventConsumer and other
create*Consumer()
methods for more information.
- Returns:
- This consumer dispatch mode
{String}
getEventFilter()
Returns the event filter of this consumer. An event filter is actually an
event id mask, which defines what event id can have a consumed event. See
HTTPFabricConnection#createEventConsumer for details.
- Returns:
- This consumer event filter
{EventListener}
getEventListener()
Returns the listener of this consumer
- Returns:
- This consumer listener
{String}
getEventScope()
Returns the event scope of this consumer. See
HTTPFabricConnection#getEventScope for
possible event scope values.
- Returns:
- This consumer event scope
{String}
getEventSelector()
Returns the event selector of this consumer. An event selector allows to
specify almost any conditions on event properties' values which should be
satisfied for an event to be consumed. See Selector for details.
- Returns:
- This consumer event selector
{String}
getFlowControlMode()
Returns the flow control mode of this consumer queue. It can have two
possible values:
- EXCEPTION: When the queue is full, each new put operation causes throwing of an exception
- NOTIFICATION: When the queue is full the corresponding advisory is raised and each new put operation blocks
- Returns:
- This consumer flow control mode
{number}
getMaxDepth()
Returns the maximum depth of this consumer queue
- Returns:
- This consumer queue maximum depth
{String}
getName()
Returns the name of this consumer
- Returns:
- This consumer name
{EventListener}
getNotificationListener()
Returns the notification listener associated with the underlying queue of
this asynchronous consumer. This listener
onEvent()
method is called on each modification of the consumer queue.
- Returns:
- The associated notification listener
{EventListener}
getRequestListener()
Returns the request listener of this consumer
- Returns:
- This consumer request listener
isStarted()
Checks either consumer started or not
isSuspended()
Checks either consumer resumed or not
resume()
Resumes the consuming of events
setDeliveryMode(mode)
Sets the delivery mode of this consumer queue. See
EventConsumer#getDeliveryMode for the mode possible values.
- Parameters:
- {String} mode
- The new delivery mode of the consumer queue
setDeliverySpinWait(spinWait)
Sets the delivery delay of this consumer queue
- Parameters:
- {number} spinWait
- The new delivery delay of the consumer queue
setEventListener(listener)
Sets the listener for this consumer
- Parameters:
- {EventListener} listener
- The listener object which
onEvent()
method will be called for each consumed event
setEventSelector(selector)
Sets the event selector for this consumer. An event selector allows to
specify almost any conditions on event properties' values which should be
satisfied for an event to be consumed. See Selector for details.
- Parameters:
- {String} selector
- The new event selector for this consumer.
setFlowControlMode(mode)
Sets the flow control mode of this consumer queue. See
EventConsumer#getFlowControlMode for the mode possible values.
- Parameters:
- {String} mode
- The new flow control mode of the consumer queue
setMaxDepth(maxDepth)
Sets the maximum depth of this consumer queue
- Parameters:
- {number} maxDepth
- The new maximum depth of the consumer queue
setNotificationListener(listener)
Sets the notification listener associated with the underlying queue of
this asynchronous consumer. This listener
onEvent()
method is called on each modification of the consumer queue.
- Parameters:
- {EventListener} listener
- The notification listener to be set
setRequestListener(listener)
Sets the request listener for this consumer
- Parameters:
- {EventListener} listener
- The request listener object which
onEvent()
method will be called for each consumed event
start()
Starts consuming of events by this consumer
stop()
Stops the consuming of events
suspend()
Suspends the consuming of events