|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IEventService
IEventService is an interface that represents the public API to the EventService.
IEventService is an interface that forms part of the service style high-level public interface to the Correlator with a focus on only dealing with Events and consumer channels.
IEventService users who need to take action when the connectivity of the service
changes should usually add a listener for the PROPERTY_CONNECTED
IEventService
property (rather than adding listeners to the lower engine client layer which can
cause locking issues).
Use EventType
and its associated classes to parse and generate Event
objects for receiving and sending using this class.
IEventServiceChannel
Field Summary | |
---|---|
static java.lang.String |
PROPERTY_CONNECTED
Property name for events fired that signal a change in the connectivity of the event service. |
Method Summary | |
---|---|
IEventServiceChannel |
addChannel(java.lang.String channelName,
java.util.Map<java.lang.String,java.lang.Object> channelConfig)
Create an EventServiceChannel specifically for listening to a given channel or channels. |
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Add a change listener for the specified property. |
void |
destroy()
Identical to the dispose() method, retained for backwards compatibility only. |
void |
dispose()
Disconnects this service from the Correlator and stops background threads. |
IEventServiceChannel |
getChannel(java.lang.String channelName)
Get an EventServiceChannel for a given channel or channels. |
EngineClientInterface |
getEngineClient()
Get a handle on the underlying EngineClient. |
boolean |
isConnected()
Get the current connectivity of the event service. |
boolean |
isDestroyed()
Determine if this service (not the Correlator) is disposed. |
void |
removeChannel(java.lang.String channelName)
Remove an EventServiceChannel for a given channel or channels. |
void |
removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Remove the property change listener for the specified property. |
void |
sendEvent(Event event)
Send an event to the Correlator using the EngineClient. |
void |
setDisconnectIfSlow(boolean disconnectIfSlow)
Set the disconnect if slow property. |
Field Detail |
---|
static final java.lang.String PROPERTY_CONNECTED
isConnected()
,
Constant Field ValuesMethod Detail |
---|
void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
All property change callbacks on the IEventService object are guaranteed to be invoked asynchronously with no locks held (but each property's callbacks will still be fired in the order the property changes occurred). This means it is safe to call any engine client or event service method (except dispose) from a listener implementation. However it also means that by the time the listener fires the current value of the property might have changed since the change notification was fired.
propertyName
- the name of the property to listen on.listener
- the listener to be added.void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
propertyName
- the name of the property to listen on.listener
- the listener to be added.EngineClientInterface getEngineClient()
IEventServiceChannel addChannel(java.lang.String channelName, java.util.Map<java.lang.String,java.lang.Object> channelConfig)
The channelName parameter is normalized by tokenizing and the tokens added to a SortedSet. If an EventServiceChannel has already been created for the normalized channelName then the existing instance will be returned.
Valid channel name delimiters are the comma, space, and tab characters.
Note: Even if the channelConfig supplied are different to those of an existing EventServiceChannel for the normalized channelName, a new EventServiceChannel will not be created.
channelName
- The name of the channel to receive events on (may be a comma separated list).channelConfig
- Configuration properties of the EventServiceChannel. See also ChannelConfig
.
IEventServiceChannel getChannel(java.lang.String channelName)
The channelName parameter is normalized by tokenizing and the tokens added to a SortedSet. If an EventServiceChannel has already been created for the normalized channelName then that instance will be returned, otherwise null is returned.
Valid channel name delimiters are the comma, space, and tab characters.
channelName
- The name of the channel for a previously added EventServiceChannel (may be a comma separated list).
void removeChannel(java.lang.String channelName)
This will cause the EventServiceChannel to be destroyed and disconnected from the Correlator. Any client code that has a reference to the EventServiceChannel will not receive any more events.
If no EventServiceChannel is found with the given channelName then a warning is logged, and the call is a no-op.
channelName
- The name of the channel for a previously added EventServiceChannel (may be a comma separated list).void sendEvent(Event event) throws EngineException
event
- The event to be sent.
EngineException
For information about how to construct an Event object.
boolean isConnected()
PROPERTY_CONNECTED
void dispose()
This will cause all EventServiceChannels to be removed and disconnected from the correlator, and the underlying EngineClient will then also be disconnected.
Java client applications should dispose any created event services once they are done with using them. To avoid deadlock, this method should never be invoked synchronously from an EventService listener.
This is a one-time operation - the service cannot be restarted.
void destroy()
dispose()
method, retained for backwards compatibility only.
boolean isDestroyed()
void setDisconnectIfSlow(boolean disconnectIfSlow)
This must be set before any EventService channels are created, or any other event receiver to the component this event service listens to, as only the first setting on a connection is used.
If an EventService's consumers are disconnected for being slow, the
EventService will notify the application using the PROPERTY_CONNECTED
property and attempt to disconnect and reconnect the client automatically,
subject to any miniumum reconnection time set using
EngineClientInterface.setReconnectPeriod(long)
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |