{"id":1003,"date":"2021-03-03T10:41:53","date_gmt":"2021-03-03T10:41:53","guid":{"rendered":"http:\/\/www.igfasouza.com\/blog\/?p=1003"},"modified":"2021-04-19T22:08:29","modified_gmt":"2021-04-19T21:08:29","slug":"real-time-locating-system-with-kafka","status":"publish","type":"post","link":"http:\/\/www.igfasouza.com\/blog\/real-time-locating-system-with-kafka\/","title":{"rendered":"Real-Time Locating System with Kafka"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/dublin-bus-out-of-service.jpg\" alt=\"\" class=\"alignnone size-full wp-image-1004\" width=\"1000\" height=\"690\" srcset=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/dublin-bus-out-of-service.jpg 1000w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/dublin-bus-out-of-service-300x207.jpg 300w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/dublin-bus-out-of-service-768x530.jpg 768w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/dublin-bus-out-of-service-624x431.jpg 624w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/p>\n<p><b>How\u2019s the craic?<\/b><br \/>\n<small style=\"color:#9f9f9f\">2021\/03\/03<\/small><\/p>\n<p>This is another blog about Raspberry PI, and today I want to show how I did a simple Kafka cluster demo using the Inky pHAT. It&#8217;s kind of a continuation from my previous blog, <a href=\"http:\/\/www.igfasouza.com\/blog\/kafka-at-the-edge-with-raspberry-pi\/\" rel=\"noopener\" target=\"_blank\">Kafka at the edge with Raspberry PI<\/a>.<\/p>\n<p>If you&#8217;re not familiar with Kafka, I suggest you have a look at my previous post <a href=\"http:\/\/www.igfasouza.com\/blog\/what-is-kafka\/\" rel=\"noopener\" target=\"_blank\">What is Kafka?<\/a> before, and you can have a look at how I created the Kafka cluster <a href=\"http:\/\/www.igfasouza.com\/blog\/raspberry-pi-kafka-cluster\/\" rel=\"noopener\" target=\"_blank\">here<\/a>.<\/p>\n<p>The Inky pHAT is an add-on board for Raspberry Pi, that has a low-energy, high-falutin, electronic paper (ePaper \/ eInk \/ EPD) display for your Pi, in three different color schemes: red\/black\/white, yellow\/black\/white, and black\/white.<br \/>\nYou can learn more about Inky pHAT <a href=\"https:\/\/shop.pimoroni.com\/products\/inky-phat?variant=12549254217811\" rel=\"noopener\" target=\"_blank\">here<\/a> and check the API <a href=\"https:\/\/github.com\/pimoroni\/inky\" rel=\"noopener\" target=\"_blank\">here<\/a>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/eink.jpg\" alt=\"\" class=\"alignnone size-full wp-image-1005\" width=\"467\" height=\"261\" srcset=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/eink.jpg 467w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/eink-300x168.jpg 300w\" sizes=\"auto, (max-width: 467px) 100vw, 467px\" \/><\/p>\n<p>Real-Time Locating System (RTLS) enables identifying and tracking the location of objects or people in real-time. It is used everywhere in transportation and logistics across industries.<\/p>\n<p><b>Use Cases<\/b><\/p>\n<ul>\n<li>\n<b>Real-time alerting on a single event:<\/b> Monitor assets and people and send an alert to a controller, mobile app, or any other interface if an issue happens.<\/li>\n<li>\n<b>Continuous real-time aggregation of multiple events:<\/b> Correlation data while it is in motion. Calculate average, enforce business rules, apply an analytic model for predictions on new events, or any other business logic.<\/li>\n<li>\n<b>Batch analytics on all historical events:<\/b> Take all historical data to find insights, e.g., for analyzing issues of the past, planning future location requirements, or training analytic models.<\/li>\n<\/ul>\n<p>This is not an exhaustive list.<\/p>\n<p>A postmodern RTLS requires an open architecture and high scalability and of course, the implementations can rely on Kafka.<\/p>\n<h2>Idea<\/h2>\n<p>A simple Raspberry Pi Kafka example where I can use one node to get the open Dublin Bus data and display it in real-time on the other node using Inky phat.<\/p>\n<p>For the producer part, you can use my Micronaut Sense hat example as a start point and just change to use Dublin Bus data instead. You can get the full Micronaut Kafka Producer code on my <a href=\"https:\/\/github.com\/igfasouza\/micronaut_sensehat\" rel=\"noopener\" target=\"_blank\">GitHub<\/a>.<\/p>\n<p><a href=\"https:\/\/data.smartdublin.ie\/dataset\/gtfs-r-real-time-passenger-information\" rel=\"noopener\" target=\"_blank\">https:\/\/data.smartdublin.ie\/dataset\/gtfs-r-real-time-passenger-information<\/a><br \/>\n<a href=\"https:\/\/developer.nationaltransport.ie\/api-details#api=gtfsr&amp;operation=gtfsr\" rel=\"noopener\" target=\"_blank\">https:\/\/developer.nationaltransport.ie\/api-details#api=gtfsr&amp;operation=gtfsr<\/a><\/p>\n<p>For the consumer part, you can use my Quarkus example. You can get the full Quarkusl Kafka Consumer code on my <a href=\"https:\/\/github.com\/igfasouza\/quarkus-kafka-consumer\" rel=\"noopener\" target=\"_blank\">GitHub<\/a>.<\/p>\n<p><b>Results<\/b><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/eink3-300x211.jpg\" alt=\"\" class=\"alignnone size-medium wp-image-1006\" width=\"300\" height=\"211\" srcset=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/eink3-300x211.jpg 300w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/eink3.jpg 532w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<div class=\"twitter-tweet\">\n<blockquote class=\"twitter-tweet\" data-lang=\"en\">\n<p lang=\"in\" dir=\"ltr\">Raspberry PI + fun<br \/>real time bus with apache kafka<a href=\"https:\/\/twitter.com\/Raspberry_Pi?ref_src=twsrc%5Etfw\">@Raspberry_Pi<\/a> <a href=\"https:\/\/twitter.com\/apachekafka?ref_src=twsrc%5Etfw\">@apachekafka<\/a> <a href=\"https:\/\/twitter.com\/pimoroni?ref_src=twsrc%5Etfw\">@pimoroni<\/a><a href=\"https:\/\/twitter.com\/hashtag\/pimoroni?src=hash&amp;ref_src=twsrc%5Etfw\">#pimoroni<\/a> <a href=\"https:\/\/twitter.com\/hashtag\/apachekafka?src=hash&amp;ref_src=twsrc%5Etfw\">#apachekafka<\/a> <a href=\"https:\/\/twitter.com\/hashtag\/raspberrypi?src=hash&amp;ref_src=twsrc%5Etfw\">#raspberrypi<\/a> <a href=\"https:\/\/t.co\/oE8eNjBJW1\">pic.twitter.com\/oE8eNjBJW1<\/a><\/p>\n<p>&mdash; Igor De Souza (@Igfasouza) <a href=\"https:\/\/twitter.com\/Igfasouza\/status\/1297556313518616576?ref_src=twsrc%5Etfw\">August 23, 2020<\/a><\/p><\/blockquote>\n<\/div>\n<p>Kafka can be deployed as a single broker in a vehicle and a global Kafka infrastructure can spread to multiple cloud providers, regions, countries, or even continents and integrate with tens or hundreds of factories or other edge locations.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/kafka_at_the_edge1.jpg\" alt=\"\" class=\"alignnone size-full wp-image-1007\" width=\"924\" height=\"481\" srcset=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/kafka_at_the_edge1.jpg 924w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/kafka_at_the_edge1-300x156.jpg 300w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/kafka_at_the_edge1-768x400.jpg 768w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/kafka_at_the_edge1-624x325.jpg 624w\" sizes=\"auto, (max-width: 924px) 100vw, 924px\" \/><\/p>\n<p><b>Curiosity<\/b><\/p>\n<p>1- Dublin bus is already using an e-ink display to show bus stop data.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/eink1-223x300.jpg\" alt=\"\" class=\"alignnone size-medium wp-image-1008\" width=\"223\" height=\"300\" srcset=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/eink1-223x300.jpg 223w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/eink1.jpg 511w\" sizes=\"auto, (max-width: 223px) 100vw, 223px\" \/><\/p>\n<p>2- I did a demo for real-time data from connected vehicles some time ago.<\/p>\n<div class=\"twitter-tweet\">\n<blockquote class=\"twitter-tweet\" data-lang=\"en\">\n<p lang=\"en\" dir=\"ltr\">Streaming demo, Lambda and Kappa architecture.<\/p>\n<p>Real time data from connect vehicles.<\/p>\n<p>Flume + OCI Streaming + Spark + NoSQL + Spring boot dashboard<a href=\"https:\/\/twitter.com\/hashtag\/oracle?src=hash&amp;ref_src=twsrc%5Etfw\">#oracle<\/a> <a href=\"https:\/\/twitter.com\/hashtag\/oci?src=hash&amp;ref_src=twsrc%5Etfw\">#oci<\/a> <a href=\"https:\/\/t.co\/GTUem3CWWH\">pic.twitter.com\/GTUem3CWWH<\/a><\/p>\n<p>&mdash; Igor De Souza (@Igfasouza) <a href=\"https:\/\/twitter.com\/Igfasouza\/status\/1169716228610506754?ref_src=twsrc%5Etfw\">September 5, 2019<\/a><\/p><\/blockquote>\n<\/div>\n<p>3- I won a prize at Europe&#8217;s First government-funded Blockchain Hackathon with the idea of an app to track medical devices combining Kafka and BlockChain.<\/p>\n<div class=\"twitter-tweet\">\n<blockquote class=\"twitter-tweet\" data-lang=\"en\">\n<p lang=\"en\" dir=\"ltr\">Europe&#39;s First government funded Blockchain Hackathon! <a href=\"https:\/\/twitter.com\/hashtag\/ireland?src=hash&amp;ref_src=twsrc%5Etfw\">#ireland<\/a><br \/>Team: BlockPirates<a href=\"https:\/\/twitter.com\/hashtag\/BlockAthonIRE?src=hash&amp;ref_src=twsrc%5Etfw\">#BlockAthonIRE<\/a> <a href=\"https:\/\/twitter.com\/BlockAthonIRE?ref_src=twsrc%5Etfw\">@BlockAthonIRE<\/a> <a href=\"https:\/\/twitter.com\/juarezjunior?ref_src=twsrc%5Etfw\">@juarezjunior<\/a> Elaine Akemi <a href=\"https:\/\/t.co\/zk8jBxZfXf\">pic.twitter.com\/zk8jBxZfXf<\/a><\/p>\n<p>&mdash; Igor De Souza (@Igfasouza) <a href=\"https:\/\/twitter.com\/Igfasouza\/status\/1089217382952910849?ref_src=twsrc%5Etfw\">January 26, 2019<\/a><\/p><\/blockquote>\n<\/div>\n<h2>Links<\/h2>\n<p><a href=\"https:\/\/towardsdatascience.com\/tracking-nyc-citi-bike-real-time-utilization-using-kafka-streams-1c0ea9e24e79\" rel=\"noopener\" target=\"_blank\">https:\/\/towardsdatascience.com\/tracking-nyc-citi-bike-real-time-utilization-using-kafka-streams-1c0ea9e24e79<\/a><\/p>\n<p><a href=\"https:\/\/eng.lyft.com\/a-new-real-time-map-matching-algorithm-at-lyft-da593ab7b006\" rel=\"noopener\" target=\"_blank\">https:\/\/eng.lyft.com\/a-new-real-time-map-matching-algorithm-at-lyft-da593ab7b006<\/a><\/p>\n<p><a href=\"https:\/\/github.com\/ds4es\/real-time-units-gps-tracking\" rel=\"noopener\" target=\"_blank\">https:\/\/github.com\/ds4es\/real-time-units-gps-tracking<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How\u2019s the craic? 2021\/03\/03 This is another blog about Raspberry PI, and today I want to show how I did a simple Kafka cluster demo using the Inky pHAT. It&#8217;s kind of a continuation from my previous blog, Kafka at&hellip; <a href=\"http:\/\/www.igfasouza.com\/blog\/real-time-locating-system-with-kafka\/\" class=\"more-link\">Continue Reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":1004,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[17,7,13],"class_list":["post-1003","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-java","tag-kafka","tag-raspberry-pi"],"_links":{"self":[{"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/posts\/1003","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/comments?post=1003"}],"version-history":[{"count":7,"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/posts\/1003\/revisions"}],"predecessor-version":[{"id":1124,"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/posts\/1003\/revisions\/1124"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/media\/1004"}],"wp:attachment":[{"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/media?parent=1003"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/categories?post=1003"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/tags?post=1003"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}