The Publisher API is invoked by feed handlers to build and process messages. See the section entitled “Use cases for feed handlers” for examples of how a feed handler can use the Publisher API.
The Publisher API uses the template processing module as its source of information about message formats.
Initializes the Publisher API. This method must be called before any other API in the Publisher API. This method should be called only once.
uint16_t pub_initialize( PUB_STARTUP * startup_settings );
Contains information needed by the publisher in order to initialize.
The directory in which to locate the publisher.xml file.
The directory in which to locate RDS templates.
A value indicating whether strict checking should be performed on messages being built. True indicates that strict checking should be performed. This setting is recommended during development. False indicates that strict checking should not be performed. This setting is recommended in production.
True if the feed handler has initialized the log file and false if the Publisher should initialize the log file.
A value indicating the type of publisher this is. For example, “Fast Feed Handler” or “Demo Feed Handler”. This information is used to identify the type of publisher when displaying information in the Operations Console.
Callbacks used to notify the caller of the Publisher API of events. One callback is currently supported, which is a function to call if the Publisher receives a request to shutdown.
The caller of the Publisher API may need to perform shutdown activities that need to occur prior to the shutdown of the Publisher API. The Publisher API invokes this callback function to notify the caller that a request to shut down has been received. The caller is responsible for performing whatever actions need to be taken and then invoke the Publisher's shutdown API.
uint16_t error_code
An error code or ERR_NONE (value 0).
Indicates to the Publisher that a new message is being built. This method must be called before setting any of the fields on the message.
uint16_t pub_beginMessage( uint16_t message_type, PUB_SEND_MESSAGE_CONTEXT * msg ).
The type of message. This value needs to match the message type indicated in the template.
The message context for the message being built.
This structure must be allocated before calling this method. To
build multiple messages at once from multiple threads, allocate
several PUB_SEND_MESSAGE_CONTEXT
structures
and use one per message being simultaneously built.
uint16_t error_code
An error code or ERR_NONE (value 0).
Indicates to the Publisher that a message that was being built
is to be cancelled. This method is called after beginMessage
to
free up any resources being used by the message context.
uint16_t pub_cancelMessage( PUB_SEND_MESSAGE_CONTEXT * msg );
The message context for the message being built.
uint16_t error_code
An error code or ERR_NONE (value 0).
Sets the value of a field in a message that is being built.
uint16_t pub_setInt8Field( PUB_SEND_MESSAGE_CONTEXT * msg, char * field_name, int8_t field_value );
uint16_t pub_setInt16Field( PUB_SEND_MESSAGE_CONTEXT * msg, char * field_name, int16_t field_value );uint16_t pub_setInt32Field( PUB_SEND_MESSAGE_CONTEXT * msg, char * field_name, int32_t field_value );uint16_t pub_setInt64Field( PUB_SEND_MESSAGE_CONTEXT * msg, char * field_name, int64_t field_value );uint16_t pub_setUInt8Field( PUB_SEND_MESSAGE_CONTEXT * msg, char * field_name, uint8_t field_value );uint16_t pub_setUInt16Field( PUB_SEND_MESSAGE_CONTEXT * msg, char * field_name, uint16_t field_value );uint16_t pub_setUInt32Field( PUB_SEND_MESSAGE_CONTEXT * msg, char * field_name, uint32_t field_value );uint16_t pub_setUInt64Field( PUB_SEND_MESSAGE_CONTEXT * msg, char * field_name, uint64_t field_value );
uint16_t pub_setDecimalField( PUB_SEND_MESSAGE_CONTEXT * msg, char * field_name, double field_value );
The following method accepts a mantissa (the significant digits) and an exponent. The value of the decimal is mantissa x 10^exponent.
uint16_t pub_setDecimalFieldFromMantissa( PUB_SEND_MESSAGE_CONTEXT * msg, char * field_name, int64_t mantissa, int8_t exponent );uint16_t pub_setDateField( PUB_SEND_MESSAGE_CONTEXT * msg, char * field_name, uint32_t field_value );uint16_t pub_setTimeField( PUB_SEND_MESSAGE_CONTEXT * msg, char * field_name, uint32_t field_value );uint16_t pub_setDateTimeField( PUB_SEND_MESSAGE_CONTEXT * msg, char * field_name, uint64_t field_value );uint16_t pub_setStringField( PUB_SEND_MESSAGE_CONTEXT * msg, char * field_name, uchar * field_value);
The message context for the message being built.
The name of the field being set. This name is only used when strict checking is on.
The value of the field which is to be placed into the message.
Express the number of days since year 0000.
Express the number of microseconds since midnight.
Consist of a 32-bit date value followed by a 32-bit time value.
All string values are in UTF-8 format.
uint16_t error_code
An error code or ERR_NONE (value 0).
Sends a market data message. This method may or may not physically send a message. Messages are buffered until a packet is full, and then sent over the network.
uint16_t pub_sendMessage( PUB_SEND_MESSAGE_CONTEXT * msg );
The message context for the message being built.
uint16_t error_code
An error code or ERR_NONE (value 0).
Sends any buffered market data messages over the network to the subscribers.
uint16_t pub_flush( void );
uint16_t error_code
An error code or ERR_NONE (value 0).
Disconnects from the network and discards any resources being used by the Publisher API. This method is called when the feed handler is finished using the Publisher API.
uint16_t pub_shutdown( bool flush );
Indicates whether any buffered messages should be sent before disconnecting.
uint16_t error_code
An error code or ERR_NONE (value 0).