Transit Monitoring

As an example of data ingest that could pose difficulties, but with Apache NiFi is easy - let's look at Transit Data. As an example I want to ingest data for NJ Transit which is New Jersey's (USA) transit system for trains, light rail and buses. There are a few different links and they provide RSS (a type of XML). Let's ingest over REST, convert from RSS to JSON and then store this data and use it for queries and maps.

This is easy and no code.

Step by Step Instructions

  • Build a list of URLS:






  • Call those URLs with InvokeHTTP

  • Use QueryRecord to convert from XML to JSON (could also go to AVRO, Parquet or other options).

  • Use FlattenJson to make it cleaner

  • Next step is an UpdateRecord to add some fields useful for queries like timestamp (${now():toNumber()}), unique ID (${uuid}), service name and location name.

  • Finally I store to Kudu via PutKudu which will store to my table impala::default.transitstatus using the JSONReader. I don't need to know field names or anything else about the table. DDL:

  • Also I send it to Kafka via PublishKafkaRecord_2.

  • If you wanted you could also send to any Cloud (AWS, Azure, GCS) storage or service, databases via PutDatabaseRecord, MongoDB, Elastic, SOLR, File Systems, JMS, TCP/IP, MQTT or more. You can add as many stores as you wish.

SQL Table Create for Apache Kudu / Apache Impala

CREATE TABLE transitstatus (

`uuid` STRING,


`locationname` STRING,

`servicename` STRING,

`title` STRING,

`description` STRING,

`pubdate` STRING,

`link` STRING,

`guid` STRING,

PRIMARY KEY (`uuid`,`ts` ) )


STORED AS KUDU TBLPROPERTIES ('kudu.num_tablet_replicas' = '1');

Example Data

[ { "title" : "BUS 11 - May 21, 2021 01:50:45 PM", "description" : "Social Distancing Barriers to be Removed from Buses – Effective Saturday, May 22, 2021", "link" : "", "guid" : "", "pubDate" : "May 21, 2021 01:50:45 PM", "ts" : "1622581895034", "locationname" : "NJ", "uuid" : "1b9f11e4-b50e-495f-b6ef-50475580d374", "servicename" : "BusAdvisories_feed.xml"} ]
<item> <title>Feb 08, 2021 01:11:40 PM</title> <description>NJ TRANSIT Introduces New “FlexPass” Ticket Option – Effective Monday, February 8, 2021</description> <link></link> <guid></guid> <pubDate>Feb 08, 2021 01:11:40 PM</pubDate> </item>