About the Network Rail feeds

From Open Rail Data Wiki
Revision as of 16:33, 28 April 2013 by Jonathon Hurley (talk | contribs) (Added detail to 'how to access feeds' sections and moved Reference Data to the feeds table to highlight the fact that they are a subscribable topic)
Jump to navigation Jump to search

What are the feeds?

The following feeds are available:

Feed Type Details
RTPPM Real-time low volume Real Time Public Performance Measure. This shows the performance of trains against the timetable, measured as the percentage of trains arriving at destination on time, and is updated every minute
Train Movements Real-time high-volume Messaging from the TRUST system, containing reports of train movements past timetabled calling and passing points.

Note: Messages are batched to reduce network overheads.

TD Real-time high-volume Berth-level data from the Train Describer system, showing raw data with train movements in more detail than the Train Movements feed.

Note: Messages are batched to reduce network overheads.

VSTP Real-time low-volume Late-notice train schedules which are not available through the Schedule feed
TSR Low-volume Temporary Speed Restriction data as published in the Weekly Operating Notice
SCHEDULE Static data Extracts of train schedules from ITPS in JSON format
Reference Data Static data Reference data which can be used to help analyse other data feeds

How do I get the data?

First, register for an account by visiting http://datafeeds.networkrail.co.uk. You will receive a confirmation email. Follow the instructions to log in and change your password. When your account is active, you can connect to the service. Your account may be in one of three states - the system will send you an email when your account is activated and able to access feeds.

Once you have logged in to the system, the My Feeds tab lists all of the data feeds available. You must select the topics that you wish to access. This can be done by highlighting them in the Available column and clicking the right arrow icon to move them to the Selected column. Once you have selected your chosen feeds, click the Update Subscription button. You will then be able to access those feeds.

Accessing the data feeds

Real-time feeds are accessed through the STOMP protocol from the Network Rail ActiveMQ message server. A STOMP client subscribes to a topic (a specific data feed) and is then sent messages within that topic. You will need a STOMP client (available in most languages - a list is available here) or an OpenWire client. Messages are queued and sent to any connected subscribers.

The static feeds are available via authenticated HTTP GET requests.

Good practice

Please bear in mind the following points when you use the service - they're here to make sure everyone gets a good service:

  • Sign up with one account - it gives an accurate reflection of how many people are actually using the service.
  • Connect to the service once - you can receive multiple feeds in a single connection. If you need to access the data more than once, you can do so - but be sensible!
  • Don't leave a failed client running - if you can connect but get an authentication or authorization error, stop your client, don't leave it continually trying.
  • Make sure your client handles failures - if your client fails to connect or is disconnected, use an exponential backoff and wait 1s, 2s, 4s, 8s, 16s etc. before trying to reconnect. Service problems sometimes occur, and if everyone tries to reconnect every second, the service will not recover quickly.
  • Use a durable subscriber - if you want data to be queued in case you disconnect, request a durable subscription when you connect.

Examples

Example code is available for several common languages:

NOTE: This code has been written by members of the community as a starting point, and may not be a complete solution.

Advanced Uses

The advanced usage page lists some advanced applications for the data feeds, including bridging the ActiveMQ feeds to your own messaging server.

Support

If you are having problems with the feeds:

  • First, read this wiki - there's a lot of material here that will help you
  • Check the FAQ to see if you have a common issue
  • If you want to discuss your problem with other people working with the service, the openraildata-talk group on Google Groups will be useful
  • Finally, if you're still having a problem, email nrod.support@rockshore.net

Background reading

It may be useful to understand the background to the sources of some of these data feeds. These links will help:

Releases

For further information on the content of releases please see Release notes