Darwin Sample

National Rail Enquiries Darwin Push Port Sample Reader (UK)

Last Updated:  9th April 2105

Introduction

National Rail Enquiries have recently opened up access to the real time train running/prediction information within their Darwin system (here in the UK).  For details on how to access this information, see the Open Rail Data Wiki.

I have put together a sample that shows how to receive messages from the Darwin push port and parse the messages using Microsoft technologies:

ScreenShot

Functionality

The app supports:

  • Reading messages from a Darwin Push Port Queue.
  • Displaying the raw content of the message (after the GZIP compression has been removed)
  • Displaying the parsed content of the message (after the XML has been deserialized into .NET classes)
    • NB:  This may look similar to the raw content view, but the parsed view shows the result of deserializing the raw messages to .NET classes and then serializing these classes back to XML for display in the UI.
  • Reading and displaying messages from a Darwin Push Port Log File.
  • Writing the received messages to a zip file (which can then also be opened in the app).
  • Autostart so can start receiving messages immediately upon running the app (i.e. no need to click the “Read From Queue” button).

Requirements

  • .NET Framework 4.5 – can be downloaded from Microsoft.
  • An account registered on the National Rail Data Feeds website (since the Darwin Queues are private to each user and should not be shared – you will need to register for your own).

Downloads

Instructions

To use the sample application to read from the Push Port Queue:

  1. Download the binaries zip using the link above and extract it.
  2. Open the DarwinPushPortSample.exe.config file (e.g. in notepad)
  3. Replace the value “InsertYourQueueNameHere” with your private queue name found on the “My Feeds” tab in the National Rail Data Feeds website.  Save the file.
  4. Run the application.
  5. Click the “Read From Queue” button to start reading.  Messages should start appearing in the list.  Click on one of the messages to see the content.

To use the sample application to read messages from a Push Port log file (available via FTP):

  1. Download the binaries zip using the link above and extract it.
  2. Go to the “Read Log File” tab.
  3. Click “Read Log File”.
  4. In the File Open dialog, select the Darwin Push Port log file that you have downloaded.

Libraries

The sample application makes use of the Apache Openwire libraries.

Advertisements

3 comments

    • The Binaries zip is clean (according to my virus scanner and a second online virus scanner I just checked with). Some web browsers (e.g. chrome) warn when downloading files from not-so-frequently-visited web pages that they may be suspicious, this warning can be ignored.

  1. Hi, Can you help. I am trying to get the feed into a entity. But I am struggling with my lack of XML knowledge. I can see the oPPort object, how do I get the elements? Regards


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s