Using Reliable Transport
Using Reliable Transport¶
SM requires to be registered with a Reliable Transport (RT) compatible message bus to receive the table updates and publish the
_prtnEnd signals. Currently, the user is responsible for providing the RT implementation which SM can connect to. Here, we describe the steps required to connect SM to a RT message bus that employs the basic kdb+ tickerplant (https://github.com/KxSystems/kdb-tick) as an example of RT implementation.
The tickerplant is started by running
q tick.q sym /tplogs -p 5010
(the destination path for TP log files and the port number 5010 can be arbitrary). The file
tick/sym.q needs to contain the empty schema for SM internal tables (
_reload) as well as all custom tables to be sent via the tickerplant:
// internal tables (with `time` and `sym` columns added by RT client for compatibility) (`$"_prtnEnd")set ( time:"n"$(); sym:`$(); startTS:"p"$(); endTS:"p"$(); opts:()); (`$"_reload")set ( time:"n"$(); sym:`$(); mount:`$(); params:()); // other tables trade:( time:"n"$(); sym:`$(); realTime:"p"$(); price:"f"$(); size:"j"$()); quote:( time:"n"$(); sym:`$(); realTime:"p"$(); bid:"f"$(); ask:"f"$(); bidSize:"j"$(); askSize:"j"$());
bus section of the assembly configuration file needs to have an entry named
protocol set to
custom for external RT implementation (the only option currently supported).
bus: stream: protocol: custom nodes: localhost:5010 topic: dataStream
The host and port of the tickerplant are specified in
nodes. The string specified for
topic is used as a topic for subscribing and registering as publisher (ignored in the basic tickerplant implementation).
SM interacts with the tickerplant using the client library which is a q file placed at the location pointed to by the environment variable
KXI_RT_LIB. The content of this file for the basic tickerplant is provided here and can be adjusted as appropriate for a custom tickerplant implementation.