Get started

To help users consume data from non java application, we provide a wrapper server that wrap around our Java implementation and expose the data through a TCP end point.

Distribution package

The wrapper server is located in the feed-connector folder and has the following structure


├── feed-connector
|   |
│   ├── conf
│   │   ├── libSportConfig.json       # Configuration file for the wrapper server
│   │   └── logback.xml               # Configuration file for logging data
|   |
│   ├── examples          # Contains examples in different languages
|   |
│   ├── logs
│   │   | 
│   │   └── ..... Log generated by the provided server and client ...
|   |
│   ├── runClient.bat     # batch script for running 
│   └── runServer.bat
|
├── feed-java
|   |
│   └── ... stuffs for java users ...
|
└── libs

Running the test programs

You should first test the distribution with your given credentials to ensure your credentials is working. To do this, locate the configuration file in the conf folder and replace the necessary fields. Details about configuration file can be found in this section

After entering necessary information, you can run the server using the runServer.bat script on Windows. On other environments, such as Linux, you will need to adapt this script correspondingly.

After running the server successfully, you can run the client runClient.bat. If everything is successful, you would see the data streamed from the wrapper to the client printed out to the log file json_feeds.log in the logs folder.

Testing with Telnet

If you are familiar with Telnet, you can directly test using Telnet


> telnet localhost 8992

After successfully connecting using telnet, you can start consume data by typing:

{"type": "SUBSCRIBE"}

into the telnet prompt. This will initialize the consumption process and you will start seeing data printed out to the telnet console.

Protocol

The wrapper use TCP to send data. The messages are in JSON format and are streamed to the clients through TCP connections to port 8992. The life cycle of a connection is as following.

Initialization

Client establishes TCP connection to wrapper server. Client sends SUBSCRIBE message which is a JSON string like following: {"type":"SUBSCRIBE"}

Streaming

Server responses with streams of following json messages. The explanation of the messages is detailed in this section

Note that, you should use a JSON stream parser to parse the messages sent from the server.

Disconnect process

Client send unsubscribe message: {"type": "UNSUBSCRIBE"} Server close the connection. After this, client will need to create a new TCP connection and subscribe again to receive new events.

Network error

In case of network failure, the server will close the broken connection. Client will need to reconnect and subscribe to server again.