The following C API defines the function signatures that you must implement to build a message handler.
Create and initialize the Sybase RAP message handler. This method is invoked from the FAST Feed Handler code by dynamically looking up this function pointer in the message handler shared library.
extern “C” int32_t initializeRAPHandler ( ffh_mh_info * info, ffh_init_param * initParams, int32_t initParamLen );
the info structure for calls to the message handler
the initialization parameters for the handler
the number of elements in the initParams array
int32_t 0 if the initialization succeeded, non 0 error code otherwise.
Create a new instance
of the RAP message handler, and assign it to the user_data
field of the ffh_mh_info
.
Invoke the initialize method on the RAP message handler and return the result.
Invoke the Message Handler finalize method and clean up any remaining resources. This method is invoked from the FAST Feed Handler code by dynamically looking up this function pointer in the message handler shared library.
extern “C” void finalizeRAPHandler ( ffh_mh_info * info );
the info structure for calls to the message handler
Cast the user_data
field of the ffh_mh_info
to
a RAP message handler object.
Invoke the finalize method on the message handler object.
Delete the handler object and set the user_data
pointer in the ffh_mh_info
to
null.
Invoke the Message Handler process method. This method is invoked from the FAST Feed Handler code by dynamically looking up this function pointer in the message handler shared library.
Cast the user_data
field of the ffh_mh_info
to
a RAP message handler object.
If the event type is MHET_RECEIVE_MESSAGE
,
invoke the receiveMessage method on the message handler object and
return the result.
extern “C” int32_t processRAPCallback ( ffh_mh_event * event );
the event to be processed
int32_t error_code
Initialize the Message Handler with any necessary setup actions. In particular, initialize the publisher API. The following table gives the initialization parameters required to be in the message handler definition in the FAST Feed Handler main configuration file.
Name Value |
Description |
---|---|
|
This should point at the configuration file for the publisher. |
int32_t initialize( ffh_mh_info * info ffh_init_param * initParams, int32_t initParamLen );
This should point at the configuration file for the publisher.
the info structure for calls to the message handler
the initialization parameters for the handler
he number of elements in the initParams array
int32_t 0
if
initialization succeeded, error code != 0
otherwise.
Initialize the RAP
Publisher API, passing a reference to the static publisherShutdown
method and pass in the loggerID
pointer.
If an error occurs, log it and return false.
Create a new RAP publisher send message context.
Store the ffh_mh_info
in
the provided pointer.
Return 0
.
Process a decoded FAST message by mapping it into the publisher API.
the info structure for this message handler
the decoded FAST message
int32_t 0
if
processing succeeded; error code != 0
otherwise
This method will contain hard-coded entries for processing specific FIX messages. The general semantics are as follows:
Walk the FIX message.
If it is a message that is recognized, store any data required for a RAP Publisher message, and once a RAP Publisher message is complete, invoke the publisher begin message API, plug in the available data, and call the publisher send message API.
Repeat for each Publisher message contained within the FIX message. Details on the mappings can be found in Section 9 below. In the event that the FIX message is not supported, log a message indicating that the message type was not processed. In the event of an error from the publisher API, log the error and call the publisher cancelMessage API.
Once the entire FIX message has been processed (or if the message was not processed, or if an error has occurred), invoke the releaseMessage callback from the handler info structure.
Clean up any resources allocated in the initialize method.
void finalize();
Call the publisher API shutdown method.
Free the send message context.
Clean up any remaining data structures.
This is the callback method required by the Publisher API in order to indicate that a shutdown has been requested.
static void publisherShutdown();
If the ffh_mh_info structure
is
not null, invoke the structure session shutdown function, passing
in the ffh_mh_info
.