Advanced Uses

From Open Rail Data Wiki
Revision as of 21:04, 11 July 2015 by Q (talk | contribs) (Added category)

Bridging Topics

It is possible to 'bridge' data from the Data Feeds platform to your own ActiveMQ server. You may want to do this if:

  • You need to store messages for longer than the durable subscription TTL of 5 minutes
  • You want to have multiple consumers connected over a slow network connection

If you do this, please don't simply re-publish data for other people or organisations. Usage of the Data Feeds platform is monitored, and more users equals better opportunity for making further data available!

Be warned - this example assumes knowledge of ActiveMQ, and is community-supported only.

Configuration

Download ActiveMQ and add the following configuration to conf/activemq.xml:

<bean id="nrDataFeedsRemote" class="org.apache.activemq.ActiveMQConnectionFactory">
  <property name="brokerURL" value="tcp://datafeeds.networkrail.co.uk:61619"/>
  <property name="userName" value="YOUR_USERNAME"/>
  <property name="password" value="YOUR_PASSWORD"/>
</bean>

<bean id="localBroker" class="org.apache.activemq.ActiveMQConnectionFactory">
  <property name="brokerURL" value="tcp://localhost:61616"/>
</bean>

<jmsBridgeConnectors>
  <jmsTopicConnector name="nrDataFeeds" outboundClientId="YOUR_USERNAME" outboundTopicConnectionFactory="#nrDataFeedsRemote" localTopicConnectionFactory="#localBroker">
    <inboundTopicBridges>
      <inboundTopicBridge consumerName="YOUR_USERNAME-movements" inboundTopicName="TRAIN_MVT_ALL_TOC" localTopicName="TRAIN_MVT_ALL_TOC"/>
      <inboundTopicBridge consumerName="YOUR_USERNAME-td" inboundTopicName="TD_ALL_SIG_AREA" localTopicName="TD_ALL_SIG_AREA"/>
      <inboundTopicBridge consumerName="YOUR_USERNAME-vstp" inboundTopicName="VSTP_ALL" localTopicName="VSTP_ALL"/>
      <inboundTopicBridge consumerName="YOUR_USERNAME-tsr" inboundTopicName="TSR_ALL_ROUTE" localTopicName="TSR_ALL_ROUTE"/>
      <inboundTopicBridge consumerName="YOUR_USERNAME-rtppm" inboundTopicName="RTPPM_ALL" localTopicName="RTPPM_ALL"/>
    </inboundTopicBridges>
  </jmsTopicConnector>
</jmsBridgeConnectors>

Ensure you have subscribed to the feeds you want to bridge - if you only want certain feeds, change the inboundTopicBridge tags as appropriate.

Start ActiveMQ, and check the web interface to ensure your topics are being bridged.


Network Rail Open Data Feeds
Data Feeds About the Feeds Account States Durable Subscriptions Example Code ( PHP / C# / Java / Ruby / Node.js) • Advanced UsesFAQ Release Notes
RTPPM RTPPM Feed
Train Movements Train Movements Feed Train Activation Train Cancellation Train Movement Train Reinstatement Change of Origin Change of Identity Change of Location TSPEED Field Planned Cancellations Cancellation Codes
TD TD Feed C-Class Messages S-Class Messages Train Describers TD Berths
VSTP VSTP Feed
TSR TSR Feed Route Codes
SCHEDULE SCHEDULE Feed TIPLOC Records Schedule and Location Records Association Records CIF Codes How Scheduling Works Allowances
Reference Data Reference Data Feed TOC Codes CIF Codes Delay Attribution Codes Identifying Locations (STANOX, TIPLOC, NLC and 3-Alpha Codes) STANOX Geographical Areas Train Planning data (BPLAN)