public interface EventReceiver
Title: Service Event Fabric Core
Description: Defines an Event Receiver for directly retrieving events from any event source and returning them to the user.
onEvent()
method to process
incoming events, a receiver accesses the event stream and obtains events one-at-a-time
for each invocation of the receive()
method.
Receivers may be used to sample the stream or potentially receive messages in a user-defined order by specifying Selector criteria.
EventReceiver receiver = dispatcher.createEventReceiver("Receiver", "event.id", null, EventScope.OBSERVABLE, true); ... ImmutableEventDatagram event = receiver.receive(); ... receiver.close();
Copyright: Copyright (c) 2010
Company: StreamScape Technologies
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the underlying event queue of the receiver.
|
void |
close()
Closes the receiver and drops it from the corresponding dispatcher.
|
int |
getCurrentDepth()
Returns the current number of events in the underlying event queue.
|
java.lang.String |
getEventFilter()
Returns the event filter associated with the receiver.
|
EventScope |
getEventScope()
Returns the event scope of the consumer.
|
java.lang.String |
getEventSelector()
Returns the event selector associated with the receiver.
|
FlowControlMode |
getFlowControlMode()
Returns a flow control mode of the underlying queue.
|
java.lang.String |
getGroupName()
Returns a name of the group to which the receiver belongs.
|
int |
getMaxDepth()
Returns a maximum depth of the underlying queue.
|
java.lang.String |
getName()
Returns a name of the receiver.
|
boolean |
noLocal()
Checks if the consumer will not process events raised by the owning dispatcher.
|
ImmutableEventDatagram |
receive()
Returns the next event in the stream from the underlying event queue.
|
ImmutableEventDatagram |
receive(long timeout)
Returns the next event in the stream from the underlying event queue.
|
ImmutableEventDatagram |
receive(java.lang.String eventSelector)
Returns the next event in the stream from the underlying event queue.
|
ImmutableEventDatagram |
receive(java.lang.String eventSelector,
long timeout)
Returns the next event in the stream from the underlying event queue.
|
ImmutableEventDatagram |
receiveNoWait()
Returns the next event in the stream from the underlying event queue.
|
ImmutableEventDatagram |
receiveNoWait(java.lang.String eventSelector)
Returns the next event in the stream from the underlying event queue.
|
void |
setEventSelector(java.lang.String eventSelector)
Sets the event selector associated with the receiver.
|
void |
setFlowControlMode(FlowControlMode flowControlMode)
Sets the flow control mode of the underlying event queue.
|
void |
setMaxDepth(int maxDepth)
Sets a maximum depth of the underlying queue.
|
java.lang.String getName()
java.lang.String getEventFilter()
Filter
for detailed information about filters.java.lang.String getEventSelector()
EventDispatcher
for details.
null
means that the receiver has no selector.void setEventSelector(java.lang.String eventSelector) throws EventSelectorFormatException
EventDispatcher
for details.
null
means that the receiver has no selector.eventSelector
- the selector to be set.EventSelectorFormatException
- if the selector format is wrong.int getMaxDepth()
void setMaxDepth(int maxDepth) throws IllegalReceiverStateException
maxDepth
- the maximum depth of the underlying queue to be set.IllegalReceiverStateException
- if the receiver is opened.FlowControlMode getFlowControlMode()
void setFlowControlMode(FlowControlMode flowControlMode) throws IllegalReceiverStateException
flowControlMode
- the flow control mode of the underlying queue to be set.IllegalReceiverStateException
- if the receiver is opened.EventScope getEventScope()
boolean noLocal()
true
the consumer will not process events raised by the owning dispatcher, false
otherwise.java.lang.String getGroupName()
null
.null
if the consumer is not a group receiver.void close()
void clear()
int getCurrentDepth()
ImmutableEventDatagram receive() throws StreamInterruptException
StreamInterruptException
- if the receiver is closed during an execution of this method.ImmutableEventDatagram receive(long timeout) throws StreamInterruptException
timeout
- the timeout interval.null
if a waiting time is up.StreamInterruptException
- if the receiver is closed during an execution of this method.ImmutableEventDatagram receiveNoWait()
null
immediately if no event is available.null
if there are no events in the queue.ImmutableEventDatagram receive(java.lang.String eventSelector) throws EventSelectorFormatException, StreamInterruptException
eventSelector
- Allows users to specify the matching criteria for message retrieval using
SQL-like syntax. Event properties are used as searchable arguments. For
complete selector syntax see EventDispatcher
.
null
means that the selector will be ignored.null
if there are no matching events.EventSelectorFormatException
- if the specified event selector has incorrect format.StreamInterruptException
- if the receiver is closed during an execution of this method.ImmutableEventDatagram receive(java.lang.String eventSelector, long timeout) throws EventSelectorFormatException, StreamInterruptException
eventSelector
- Allows users to specify the matching criteria for message retrieval using
SQL-like syntax. Event properties are used as searchable arguments. For
complete selector syntax see EventDispatcher
.
null
means that the selector will be ignored.timeout
- the timeout interval.null
if a waiting time is up.EventSelectorFormatException
- if the specified event selector has wrong format.StreamInterruptException
- if the receiver is closed during an execution of this method.ImmutableEventDatagram receiveNoWait(java.lang.String eventSelector) throws EventSelectorFormatException
null
immediately if no event is available.
The specified event selector is used as filtering criteria in order to obtain the next event.eventSelector
- Allows users to specify the matching criteria for message retrieval using
SQL-like syntax. Event properties are used as searchable arguments. For
complete selector syntax see EventDispatcher
.
null
means that the selector will be ignored.null
if there are no matching events.EventSelectorFormatException
- if the specified event selector has wrong format.Copyright © 2015-2024 StreamScape Technologies. All rights reserved.