Apama Documentation : Connecting Apama Applications to External Components : Working with IAF Plug-ins : C/C++ Transport Plug-in Development : The C/C++ transport plug-in development specification : The transport constructor, destructor and info functions
The transport constructor, destructor and info functions
Every event transport needs to implement a constructor function, a destructor function and an ‘info' function. These methods are called by the IAF to (respectively) instantiate the event transport, to clean it up during unloading, and to provide information about the plug-in's capabilities.
EventTransport.h provides the following definition for a pointer to the constructor function:
AP_EventTransportCtorPtr
 
/**
* Pointer to the constructor function for the transport library. Each TIL
* plugin library must export a function with this signature, named using the
* AP_EVENTTRANSPORT_CTOR_FUNCTION_NAME macro.
*
* Constructs a new instance of the event transport. This function will be
* called by the adapter main program when the adapter starts up. The
* transport should be created in a 'stopped' state, such that it is not
* actively processing data from the external transport. A call to the
* start() function is required to begin processing.
*
* Note that the input parameters (name, properties, timestampConfig) are
* owned by the caller. The IAF framework guarantees that propertes and
* timestampConfig will remain valid until after a subsequent call to
* updateProperties(), so it is safe to hold a pointer to this structure.
* You should, however, copy the name string if you wish to keep it. The
* contents of the output parameter errMsg belongs to the transport.
*
* @param name The name of this transport instance
* @param properties Transport property set derived from the IAF config file
* @param err 'Out' parameter for error code if constructor fails
* @param errMsg 'Out' parameter for error message if constructor fails
* @param timestampConfig Timestamp recording/logging settings
* @return Pointer to a new transport instance or NULL if the constructor
* fails for some reason. In the case of failure, err and errMsg should be
* filled in with an appropriate error code and message describing the
* failure.
*/
typedef AP_EVENTTRANSPORT_API AP_EventTransport* (
     AP_EVENTTRANSPORT_CALL* AP_EventTransportCtorPtr)(AP_char8* name,
       AP_EventTransportProperties* properties, AP_EventTransportError* err,
       AP_char8** errMsg, IAF_TimestampConfig* timestampConfig);
Typically part of the work of this constructor would be a call to updateProperties, in order to set up the initial configuration of the plug-in.
The destructor function's related definition is as follows:
AP_EventTransportDtorPtr
 
/**
* Pointer to the destructor function for the transport library. Each TIL
* plugin library must export a function with this signature, named using
* the AP_EVENTTRANSPORT_DTOR_FUNCTION_NAME macro.
*
* Destroys an instance of the event transport that was previously created
* by AP_EventTransport_ctor. The transport may assume that it has been
* stopped and flushed before the destructor is called.
*
* @param transport The event transport object to be destroyed
*/
typedef AP_EVENTTRANSPORT_API void (
     AP_EVENTTRANSPORT_CALL* AP_EventTransportDtorPtr)(
       AP_EventTransport* obj);
while the info function is defined as:
AP_EventTransportInfoPtr
 
/**
* Pointer to the info function for the transport library. Each transport
* plugin library must export a function with this signature, named using
* the AP_EVENTTRANSPORT_INFO_FUNCTION_NAME macro.
*
* Returns basic information about the transports implemented by this
* shared library, along with the transport API version it was built
* against.
*
* @param version 'Out' parameter for version number of transport library.
* This should be the value of AP_EVENTTRANSPORT_VERSION that was defined
* in EventTransport.h when the transport was built. The IAF will check
* the version number to ensure that it can support all the capabilities
* offered by the transport
* @param capabilities 'Out' parameter for the capabilities of the
* transports provided by this library. Currently no such capabilities
* are defined, so the value of this field will be ignored by the IAF.
* However, all bits of the capabilities value are reserved for future use,
* so current transports should ensure that they set this value to zero.
*/
typedef AP_EVENTTRANSPORT_API void (
     AP_EVENTTRANSPORT_CALL* AP_EventTransportInfoPtr)(AP_uint32* version,
       AP_uint32* capabilities);
The IAF will search for these functions by the names AP_EventTransport_ctor,AP_EventTransport_dtor and AP_EventTransport_info when the library is loaded, so you must use these exact names when implementing them in a transport layer plug-in.
Copyright © 2013-2017 Software AG, Darmstadt, Germany. (Innovation Release)

Product LogoContact Support   |   Community   |   Feedback