The message handler plug-in process function (ffh_mh_process_function) for the message handler processes a decoded FAST message by mapping it into the publisher API.
extern "C“ int32_t process( ffh_mh_event * event )
{
return (( FIXMessageHandler* )
event->info->user_data)->receiveMessage(
event->info, event->message );
}
int32_t FIXMessageHandler::receiveMessage(
ffh_mh_info * info,
ffh_fast_message * fastMsg )
{
uint32_t error_code = ERR_NONE;
// switch based on template id of incoming FAST message
switch( fastMsg->template_id ) {
case QUOTE_TEMPLATE_ID:
// start creating a RDS Stock Quote message
pub_beginMessage( STOCK_QUOTE_MSG, _msg_ctx );
// use Publisher API pub_setXXXField() calls
// to populate its fields based on fastMsg
// contents
...
break;
// handle other message types here
case ...
}
if( error_code != ERR_NONE ) {
// error processing the FAST message, cancel it
pub_cancelMessage( _msg_ctx );
} else {
// successfully processed the FAST message,
// publish it
error_code = pub_sendMessage( _msg_ctx );
}
// release no longer needed FAST message
info->release_message( info, fastMsg );
return error_code;
}