Skip to content

Ingests data from gtfs-realtime and produces the feed to Kafka, specifically for NYC bus data

Notifications You must be signed in to change notification settings

charles-tan/java-nyc-bus-gtfs-realtime-to-kafka

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

java-nyc-bus-gtfs-realtime-to-kafka

Ingests data from gtfs-realtime and produces the feed to Kafka, specifically for NYC bus data

Website link to source data: https://bustime.mta.info/wiki/Developers/GTFSRt

The gtfs-realtime framework works by consistently updating the data available by HTTP request. This Java application consistently polls these pages, converts these protobuf feed events to JSON, then produces these individual events to Kafka. The Kafka bootstrap URLs and other configurations are passed as program arguments to the Java application.

Prerequisites

Build Instructions

mvn clean package to generate the JAR in the target directory

Run Instructions

  1. export TRANSIT_KEY=<your_developer_key>

  2. Run java application (producer.config is optional if you need to pass in Kafka credentials)

    java -cp ./target/TransitRealtimeApp-jar-with-dependencies.jar App \
    --bootstrap.servers "<your comma separated kafka bootstrap servers>" \
    --producer.config "<file path to your kafka producer configuration>"
    

    An example of the Kafka producer configuration:

    security.protocol=SASL_SSL
    # kafka.client.truststore.jks is the copy of standard jvm cacert
    ssl.truststore.location=/Users/myusername/truststores/kafka.client.truststore.jks
    ssl.truststore.password=changeit
    sasl.mechanism=PLAIN
    sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \
       username="<username>" \
       password="<password>";
    

About

Ingests data from gtfs-realtime and produces the feed to Kafka, specifically for NYC bus data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages