Apama API Reference for .NET  9.10.0.4
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Apama.Services.Event.IEventService Interface Reference

IEventService is an interface that represents the public API to the EventService. More...

Inherits IDisposable.

Public Member Functions

IEventServiceChannel AddChannel (string channelName, IDictionary< string, object > channelConfig)
 Create an EventServiceChannel specifically for listening to a given channel or channels. More...
 
IEventServiceChannel AddChannel (string[] channelNames, IDictionary< string, object > channelConfig)
 Create an EventServiceChannel specifically for listening to given channels. This is the recommended method going forward providing array of channels. The older method AddChannel(string channelName, IDictionary<string, object> channelConfig) is deprecated More...
 
void Destroy ()
 Disconnects this service from the Correlator and stops background threads; equivalent to calling Dispose(). More...
 
IEventServiceChannel GetChannel (string channelName)
 Get an EventServiceChannel for a given channel or channels. More...
 
IEventServiceChannel GetChannel (string[] channelNames)
 Get an EventServiceChannel for given channels. This is the recommended method going forward providing array of channels. The older method GetChannel(string channelName) is deprecated More...
 
void RemoveChannel (string channelName)
 Remove an EventServiceChannel for a given channel or channels. More...
 
void RemoveChannel (string[] channelNames)
 Remove an EventServiceChannel for given channels. This is the recommended method going forward providing array of channels. The older method RemoveChannel(string channelName) is deprecated More...
 
void SendEvent (Apama.Event.Event evt)
 Send an event to the Correlator using the IMessagingClient. More...
 
void SetDisconnectIfSlow (bool disconnectIfSlow)
 Set the disconnect if slow property. More...
 

Properties

ICorrelatorManagement CorrelatorManagement [get]
 Get a reference to the underlying ICorrelatorManagement, if there is one, and the event service has not yet been destroyed. More...
 
bool Destroyed [get]
 Determine if this service (not the Correlator) is destroyed, which is true if it has been removed from the parent EventService using IEventService.RemoveChannel(String) More...
 
bool IsConnected [get]
 Get the current connectivity of the event service. More...
 
IMessagingClient MessagingClient [get]
 Get a reference to the underlying IMessagingClient. More...
 

Events

PropertyChangedEventHandler IsConnectedChanged
 An event that notifies subscribers of changes in the overall connectedness of the EventService. More...
 

Detailed Description

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 IsConnected IEventService property using the IsConnectedChanged event (rather than adding listeners to the lower engine client layer which can cause locking issues).

The System.IDisposable.Dispose method must be called when the EventService is no longer needed. To avoid synchronization problems such as deadlock, the Dispose method should never be called from any EventService listener callback or event handler.

Use Apama.Event.Parser.EventType and its associated classes to parse and generate Apama.Event.Event objects for receiving and sending using this class.

See also
IEventServiceChannel

Member Function Documentation

IEventServiceChannel Apama.Services.Event.IEventService.AddChannel ( string  channelName,
IDictionary< string, object >  channelConfig 
)

Create an EventServiceChannel specifically for listening to a given channel or channels.

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.

Parameters
channelNameThe name of the channel to receive events on (may be a comma separated list).
channelConfigConfiguration properties of the EventServiceChannel. See also ChannelConfig
Returns
A new or pre-existing EventServiceChannel.
Deprecated:
{Please use AddChannel(string[], IDictionary<string,object>)}
IEventServiceChannel Apama.Services.Event.IEventService.AddChannel ( string[]  channelNames,
IDictionary< string, object >  channelConfig 
)

Create an EventServiceChannel specifically for listening to given channels. This is the recommended method going forward providing array of channels. The older method AddChannel(string channelName, IDictionary<string, object> channelConfig) is deprecated

The channelNames parameter contains names of channels which is normalized by sorting it. If an EventServiceChannel has already been created for the normalized channelNames then the existing instance will be returned.

Note: Even if the channelConfig supplied are different to those of an existing EventServiceChannel for the normalized channelNames, a new EventServiceChannel will not be created.

Parameters
channelNamesNames of channels to receive events on (may be a comma separated list).
channelConfigConfiguration properties of the EventServiceChannel. See also ChannelConfig.
Returns
A new or pre-existing EventServiceChannel.
void Apama.Services.Event.IEventService.Destroy ( )

Disconnects this service from the Correlator and stops background threads; equivalent to calling Dispose().

This will cause all EventServiceChannels to be removed and disconnected from the correlator, and the underlying IMessagingClient will then also be disconnected.

.NET client applications should destroy any created event services once they have finished using them.

This is a one-time operation - the service cannot be restarted.

IEventServiceChannel Apama.Services.Event.IEventService.GetChannel ( string  channelName)

Get an EventServiceChannel for a given channel or channels.

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.

Parameters
channelNameThe name of the channel for a previously added EventServiceChannel (may be a comma separated list).
Returns
the requested EventServiceChannel, or null is none is found.
Deprecated:
{Please use GetChannel(string[])}
IEventServiceChannel Apama.Services.Event.IEventService.GetChannel ( string[]  channelNames)

Get an EventServiceChannel for given channels. This is the recommended method going forward providing array of channels. The older method GetChannel(string channelName) is deprecated

The channelNames parameter contains names of channels which is normalized by sorting it. If an EventServiceChannel has already been created for the normalized channelNames, then that instance will be returned, otherwise null is returned.

Parameters
channelNamesNames of channels for a previously added EventServiceChannel
Returns
the requested EventServiceChannel, or null is none is found.
void Apama.Services.Event.IEventService.RemoveChannel ( string  channelName)

Remove an EventServiceChannel for a given channel or channels.

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.

Parameters
channelNameThe name of the channel for a previously added EventServiceChannel (may be a comma separated list).
Deprecated:
{Please use RemoveChannel(string[])}
void Apama.Services.Event.IEventService.RemoveChannel ( string[]  channelNames)

Remove an EventServiceChannel for given channels. This is the recommended method going forward providing array of channels. The older method RemoveChannel(string channelName) is deprecated

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.

Parameters
channelNamesNames of channels for a previously added EventServiceChannel
void Apama.Services.Event.IEventService.SendEvent ( Apama.Event.Event  evt)

Send an event to the Correlator using the IMessagingClient.

Parameters
evtThe event to be sent.
void Apama.Services.Event.IEventService.SetDisconnectIfSlow ( bool  disconnectIfSlow)

Set the disconnect if slow property.

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 IsConnectedChanged event and attempt to disconnect and reconnect the client automatically, subject to any miniumum reconnection time set using Apama.Engine.Client.IMessagingClient.SetReconnectPeriod.

Property Documentation

ICorrelatorManagement Apama.Services.Event.IEventService.CorrelatorManagement
get

Get a reference to the underlying ICorrelatorManagement, if there is one, and the event service has not yet been destroyed.

Note that unless an object implementing ICorrelatorManagement (such as an IEngineClient) was provided when the EventService was constructed, this property may return null.

Returns
the ICorrelatorManagement implementation used by this service, or null if there isn't one or the EventService has been destroyed.
bool Apama.Services.Event.IEventService.Destroyed
get

Determine if this service (not the Correlator) is destroyed, which is true if it has been removed from the parent EventService using IEventService.RemoveChannel(String)

Returns
true if already destroyed, false otherwise.
bool Apama.Services.Event.IEventService.IsConnected
get

Get the current connectivity of the event service.

The value is true when everything is fine and events can be sent and received, but false if any part of the connection has a problem (for example, if the entire connection is lost, or if the remote engine has disconnected the service's consumers for being slow).

Returns
True if the connection is fully working, false if there is a problem.
See also
IsConnectedChanged
IMessagingClient Apama.Services.Event.IEventService.MessagingClient
get

Get a reference to the underlying IMessagingClient.

Returns
the IMessagingClient implementation used by this service, or null if the EventService has been destroyed.

Event Documentation

PropertyChangedEventHandler Apama.Services.Event.IEventService.IsConnectedChanged

An event that notifies subscribers of changes in the overall connectedness of the EventService.

This event is guaranteed to be fired asynchronously on a dedicated property change notification thread with no locks held - which means that it is safe to call any engine client or event service method (except Dispose) from a handler. Note that this also means that by the time the listener fires the current value of the property might have changed since the change notification was fired. Like all .NET event handlers, the handler is responsible for ensuring robust and correct behaviour if it is invoked even after it was unsubscribed from the event.

Submit a bug or feature
Copyright (c) 2013-2016 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors. Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.