Destination SystemObjects send events out of the ECS, often in an asynchronous manner due to the nature of both the ECS and the nature of the receiving protocol. Because of the unpredictable arrival of events to the destination from within the source as well as the unpredictable rate of consumption of events via the external receiver, a Destination must be threaded. This is done by specifying the right parameter for the setEventProcessor() call in the local setVars() method.
A Destination is responsible for converting an “event” in the EventGnosis’ proprietary, normalized Event format (basically a small XML document) and streaming it to the receiving external entity via its specific protocol.
The following steps need to be performed when writing a typical EventGnosis Destination. It is assumed that you do understand, in detail, the protocol for the Destination you are writing.
com.eventgnosis.destinations.EventDestinationBase,
which itself extends com.eventgnosis.system.SystemObject
and implements the com.eventgnosis.system.OutputEvents
interface. Since a Destination is a SystemObject
, you inherit significant functionality, and your new object will be part of the startup and runtime object hierarchy automatically, given that this Destination is active and configured into an ECA. This behind-the-scenes work is performed by the framework.<destinationType description="Send EventGnosis EMS events to %Host% and %Port%." objectId="EmsTcpEventSender" schema=""> <implement class="com.eventgnosis.destinations.XmlTCPIPSocketDestination" source="ecs.jar" type="Java" /> </destinationType>
This XML snippet should be placed in EV_HOME/config/extra/emptyECA.xml, the source of configuration information for the GUI and the ECS. Note that this example has two parameters (host & port), which will be set and validated by the GUI when a user selects an “EcsTcpEventSender” Destination. You will also need to set the path to your implementation (here com.eventgnosis.Destinations.XmlTCPIPSocketListener
) and its jar. Typically, you could create an addon jar that is separate from the ecs.jar and is specific to your company. This new jar must, of course, be in the classpath of the ECS for it to be recognized.
com.eventgnosis.Destinations.XmlTCPIPSocketListener.
XMLTCPIPSocketSender
are port number and interface name. Note that each parameter set by the GUI can be extracted using the object EmmlConfig (eCfg) object using method getParameter( name, instance# ), where name is the name of the parameter from its XML description and instance number is a simple index of which configuration instance (there can be more than one with the same name) starting from zero. The first instance is zero, the next one, and so on. Note that getParameter(…) returns a String
. If the Destination’s class attribute is not of type java.lang.String
it must be converted to its requisite type. Conversion utilities for the most common types can be found in com.eventgnosis.util.Util.java.
Furthermore, some types set by the GUI are not primitives but are composite types, such as the type com.eventgnosis.util.LoginInfo,
which includes user name and password. A composite type can be referred to in a SystemObject
description, but it must then be defined with a parameterType XML snippet inside ECA so that the GUI can understand the composition:<parameterType description="%Login%" objectId="Login"> <implement class="com.eventgnosis.Sources.LoginInfo" source="ecs.jar" type="Java" /> </parameterType>
If composite types are utilized, they must of course be implemented, added into your jar and the usual information specified in the “implement” section so that the ECS can locate your code. Examples of such implementations are com.eventgnosis.Destinations.LoginInfo,
and its use in setVars() in com.eventgnosis.Destinations.EmailSlave.
In summary, each Destination attribute must be carefully processed in setVars() using the following steps:
if( connection == null ) { connection = {…do connection logic } }
com.eventgnosis.destinations.XMLTCPIPSocketDestination.
SystemObject
. continueOperation() method.