EMS FastStart Manual

Building Your Application for Event Generation
EMS FastStart Manual133701
6-2
Mode 2
Mode 2
Mode 2 can be used by applications which generate many events. Mode 2 is like mode 1
but opens the defined collector only once, which reduces the use of system resources to
generate events. The only disadvantage of this mode is that EGEN completes the write
operation before returning to the calling program. In some cases, this may cause
unacceptable delays for the application.
Mode 3
Mode 3 allows EGEN to be used within a multi-threaded program because it completes
the write operation within the calling program.
Mode 4
Mode 4 uses EGEN only to format an event buffer based on the contents of the egen-
record passed to EGEN. When you use this mode, you must write the event within the
user application.
Initialize^egen^record
This procedure initializes the egen^record with default values. A default value is
specified in the DDL source file for each field within the record. See EGEN Default
Value s later in this section for detailed information on EGEN default values.
For all modes, this procedure must be called before calling the EGEN procedure. You
must call this procedure each time you want to generate an event message, otherwise
EGEN will return an error code to your application. Example 6-1
shows the syntax for
this procedure.
Table 6-1. Procedures Required for Each Mode
Procedure called for mode #
Procedure Name 1 2 3 4
Initialize^egen^record YES YES YES YES
Open^egen^collector NO YES YES *
EGEN YES YES YES YES
Complete^egen^operation NO NO YES *
Close^egen^collector NO YES YES *
*You can use these EGEN procedures or use your own customized procedures.