Examples
Since the OpenFAST 1.0.1 release, the OpenFAST binary distribution includes a few sample command line tools to play with. This set of tools includes a utility to measure the decoding performance of OpenFAST, download messages from a FAST server, and convert XML to and from a compressed FAST format.
Running the Examples
Scripts to run the examples are located in the bin directory of the binary distribution. The scripts require the JAVA_HOME environment variable to set to the location of a valid Java installation. To see a list of options use the -? option.
Performance Runner
The performance runner decodes a file containing fast-encoded data using the given templates. The results are given in total decoding time as well as average time it takes to decode a message. It is recommended to set the repeat to at least 3 as the first run is slower due to class loading.
Options
option |
long |
description |
---|---|---|
-? |
--help |
Displays this message. |
-c |
--continuous |
Keep repeating the test until the process is killed |
-d |
--data <arg> |
FAST Encoded data |
-e |
--error |
Show stacktrace information |
-f |
--format <arg> |
Data format [hex|binary] default is binary |
-n |
--ns |
Enables namespace awareness |
-p |
--preload |
Preload data into memory instead of decoding directly from file |
-r |
--repeat <arg> |
Re process data file X number of times |
-t |
--template <arg> |
Message Template definition file |
Use
To run the performance runner try:
perf.bat -t D:\data\templates.xml -d D:\data\data.fast -p -r 3
Hexadecimal format
By default the format of the FAST data file is expected to be binary. There is also support for files encoded using hexadecimal byte values. Use the "-f hex" option to use this format.
Message Consumer
The message consumer tool is used to test OpenFAST compatibility with a given data provider's FAST stream.
Options
options |
long |
description |
---|---|---|
-? |
--help |
Displays this message |
-e |
--error |
Show stacktrace information |
-h |
--host <arg> |
The host name of the server (or group name for multicast) |
-m |
--template <arg> |
Message template definition file |
-p |
--port <arg> |
Port to connect to |
-t |
--protocol <arg> |
Protocol [tcp|udp] defaults to tcp |
Use
TCP Connection
consumer.bat -h localhost -p 2001 -m templates.xml
UDP Connection
consumer.bat -t udp -h 224.0.0.1 -p 30000 -m templates.xml
XML Conversion Tools
The XML Conversion utilities are a proof of concept implementation of the proposed FAST extension Map operator. The Map operator is used to compress XML element names and attribute names.
Options
The XML Conversion tools simply takes an input file and output file.
Use
Convert XML to FAST
xml2fast.bat data.xml data.fast
Convert FAST to XML
fast2xml.bat data.fast data.xml
Producer/Consumer Demo
The bin
directory contains template and data files that the producer and consumer examples can use to communicate.
Use
On Windows
In separate shells, run:
producer.bat -p 13000 -t FASTTestTemplate.xml -x data.xml
consumer.bat -p 13000 -t FASTTestTemplate.xml
On GNU/Linux, etc.
In separate shells, run:
sh producer.sh -p 13000 -t FASTTestTemplate.xml -x data.xml
sh consumer.sh -p 13000 -t FASTTestTemplate.xml