Difference between revisions of "Advanced Uses"

From Open Rail Data Wiki
Jump to navigation Jump to search
m (→‎Advanced Uses: Removed duplicated header)
m (categorisation)
Line 38: Line 38:
  
 
Start ActiveMQ, and check the web interface to ensure your topics are being bridged.
 
Start ActiveMQ, and check the web interface to ensure your topics are being bridged.
 +
 +
[[Category:Network Rail Data Feeds]]

Revision as of 09:05, 20 May 2013

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>

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.