{"id":1293,"date":"2021-07-01T13:10:04","date_gmt":"2021-07-01T12:10:04","guid":{"rendered":"http:\/\/www.igfasouza.com\/blog\/?p=1293"},"modified":"2021-07-01T13:20:04","modified_gmt":"2021-07-01T12:20:04","slug":"kafka-weather-real-time-dashboard-with-spring-thymeleaf","status":"publish","type":"post","link":"http:\/\/www.igfasouza.com\/blog\/kafka-weather-real-time-dashboard-with-spring-thymeleaf\/","title":{"rendered":"Kafka weather real time dashboard with Spring &#038; Thymeleaf"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/spring_kafka.jpg\" alt=\"\" width=\"947\" height=\"454\" class=\"alignnone size-full wp-image-1295\" srcset=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/spring_kafka.jpg 947w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/spring_kafka-300x144.jpg 300w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/spring_kafka-768x368.jpg 768w\" sizes=\"auto, (max-width: 947px) 100vw, 947px\" \/><\/p>\n<p><b>How goes the battle?<\/b><\/p>\n<p>This post is another part of my Kafka weather station use case <a href=\"http:\/\/www.igfasouza.com\/blog\/kafka-weather-station\/\" rel=\"noopener\" target=\"_blank\">idea<\/a>.<\/p>\n<p>I want to show how I created an app using Spring Boot and Thymeleaf to show a real-time dashboard with Sense Hat temperature data that I read from a Kafka topic. This is another blog about Java on Raspberry PI.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/weather_dashboard01.png\" alt=\"\" width=\"2586\" height=\"1237\" class=\"alignnone size-full wp-image-1296\" srcset=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/weather_dashboard01.png 2586w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/weather_dashboard01-300x144.png 300w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/weather_dashboard01-1024x490.png 1024w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/weather_dashboard01-768x367.png 768w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/weather_dashboard01-1536x735.png 1536w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/weather_dashboard01-2048x980.png 2048w\" sizes=\"auto, (max-width: 2586px) 100vw, 2586px\" \/><br \/>\n<small>Picture 1: The highlighted part of the diagram that this post is focused on.<\/small><\/p>\n<p>You can check my <a href=\"http:\/\/www.igfasouza.com\/blog\/kafka-producer-consumer-overview\/\" rel=\"noopener\" target=\"_blank\">Kafka Producer<\/a> blog and <a href=\"http:\/\/www.igfasouza.com\/blog\/kafka-at-the-edge-with-raspberry-pi\/\" rel=\"noopener\" target=\"_blank\">Kafka at the edge<\/a> blog, where I explain the Sense Hat producer with Micronaut.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/Kafka_weather_dashboard01.png\" alt=\"\" width=\"2596\" height=\"827\" class=\"alignnone size-full wp-image-1297\" srcset=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/Kafka_weather_dashboard01.png 2596w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/Kafka_weather_dashboard01-300x96.png 300w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/Kafka_weather_dashboard01-1024x326.png 1024w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/Kafka_weather_dashboard01-768x245.png 768w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/Kafka_weather_dashboard01-1536x489.png 1536w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/Kafka_weather_dashboard01-2048x652.png 2048w\" sizes=\"auto, (max-width: 2596px) 100vw, 2596px\" \/><br \/>\n<small>Picture 2: end-to-end flow<\/small><\/p>\n<h2>Idea<\/h2>\n<p>A Spring Boot web application where I use Thymeleaf to display a real-time dashboard to show Temperature values that I read from a Kafka topic. I use a Websocket to update the data on the page and Spring Kafka to read the Kafka data.<br \/>\nThe Data came from a Raspberry PI using the Sense Hat.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/spring_weather01.png\" alt=\"\" width=\"1720\" height=\"885\" class=\"alignnone size-full wp-image-1298\" srcset=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/spring_weather01.png 1720w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/spring_weather01-300x154.png 300w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/spring_weather01-1024x527.png 1024w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/spring_weather01-768x395.png 768w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/spring_weather01-1536x790.png 1536w\" sizes=\"auto, (max-width: 1720px) 100vw, 1720px\" \/><br \/>\n<small>Picture 3: I added a REST interface for and a @PostConstruct method producing a message<\/small><\/p>\n<p>The program is using Spring-Kafka integration and I add a Kafka producer to get the Sense Hat data and I add a REST interface as well to be able to add some data for testing or if I don\u2019t have the Sense Hat running.<\/p>\n<h2>Code<\/h2>\n<p>First things first; configuration. There are two ways to configure our Producer and Consumer.<br \/>\nOption 1: Using application.properties or application.yml<br \/>\nOption 2: Java class with @Configuration<\/p>\n<p>I\u2019m using option 2 in this example.<\/p>\n<div class=\"codecolorer-container java blackboard\" style=\"overflow:auto;white-space:nowrap;height:300px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/>11<br \/>12<br \/>13<br \/>14<br \/>15<br \/>16<br \/>17<br \/>18<br \/>19<br \/>20<br \/>21<br \/>22<br \/>23<br \/>24<br \/>25<br \/>26<br \/>27<br \/>28<br \/>29<br \/>30<br \/>31<br \/>32<br \/><\/div><\/td><td><div class=\"java codecolorer\">@EnableKafka<br \/>\n@Configuration<br \/>\n<span class=\"kw1\">public<\/span> <span class=\"kw1\">class<\/span> KafkaConsumerConfig <span class=\"br0\">&#123;<\/span><br \/>\n<br \/>\n&nbsp; &nbsp; @Value<span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;${kafka.bootstrapserver}&quot;<\/span><span class=\"br0\">&#41;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"kw1\">public<\/span> <a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3Adocs.oracle.com+javase+docs+api+string\"><span class=\"kw3\">String<\/span><\/a> bootstrapServer<span class=\"sy0\">;<\/span><br \/>\n<br \/>\n&nbsp; &nbsp; @Bean<br \/>\n&nbsp; &nbsp; <span class=\"kw1\">public<\/span> Map<span class=\"sy0\">&lt;<\/span><a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3Adocs.oracle.com+javase+docs+api+string\"><span class=\"kw3\">String<\/span><\/a>,Object<span class=\"sy0\">&gt;<\/span> consumerConfigs<span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; Map<span class=\"sy0\">&lt;<\/span><a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3Adocs.oracle.com+javase+docs+api+string\"><span class=\"kw3\">String<\/span><\/a>,Object<span class=\"sy0\">&gt;<\/span> props<span class=\"sy0\">=<\/span><span class=\"kw1\">new<\/span> HashMap<span class=\"sy0\">&lt;<\/span><a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3Adocs.oracle.com+javase+docs+api+string\"><span class=\"kw3\">String<\/span><\/a>,Object<span class=\"sy0\">&gt;<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; props.<span class=\"me1\">put<\/span><span class=\"br0\">&#40;<\/span>ConsumerConfig.<span class=\"me1\">BOOTSTRAP_SERVERS_CONFIG<\/span>, bootstrapServer<span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; props.<span class=\"me1\">put<\/span><span class=\"br0\">&#40;<\/span>ConsumerConfig.<span class=\"me1\">KEY_DESERIALIZER_CLASS_CONFIG<\/span>, StringDeserializer.<span class=\"kw1\">class<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; props.<span class=\"me1\">put<\/span><span class=\"br0\">&#40;<\/span>ConsumerConfig.<span class=\"me1\">VALUE_DESERIALIZER_CLASS_CONFIG<\/span>, StringDeserializer.<span class=\"kw1\">class<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; props.<span class=\"me1\">put<\/span><span class=\"br0\">&#40;<\/span>ConsumerConfig.<span class=\"me1\">GROUP_ID_CONFIG<\/span>, <span class=\"st0\">&quot;temp-groupid.group&quot;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; props.<span class=\"me1\">put<\/span><span class=\"br0\">&#40;<\/span>ConsumerConfig.<span class=\"me1\">AUTO_OFFSET_RESET_CONFIG<\/span>, <span class=\"st0\">&quot;latest&quot;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw1\">return<\/span> props<span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n<br \/>\n&nbsp; &nbsp; @Bean<br \/>\n&nbsp; &nbsp; <span class=\"kw1\">public<\/span> ConsumerFactory<span class=\"sy0\">&lt;<\/span><a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3Adocs.oracle.com+javase+docs+api+string\"><span class=\"kw3\">String<\/span><\/a>, String<span class=\"sy0\">&gt;<\/span> consumerFactory<span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw1\">return<\/span> <span class=\"kw1\">new<\/span> DefaultKafkaConsumerFactory<span class=\"sy0\">&lt;&gt;<\/span><span class=\"br0\">&#40;<\/span>consumerConfigs<span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n<br \/>\n&nbsp; &nbsp; @Bean<br \/>\n&nbsp; &nbsp; <span class=\"kw1\">public<\/span> KafkaListenerContainerFactory<span class=\"sy0\">&lt;<\/span>ConcurrentMessageListenerContainer<span class=\"sy0\">&lt;<\/span><a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3Adocs.oracle.com+javase+docs+api+string\"><span class=\"kw3\">String<\/span><\/a>,String<span class=\"sy0\">&gt;&gt;<\/span> kafkaListenerContainerFactory<span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; ConcurrentKafkaListenerContainerFactory<span class=\"sy0\">&lt;<\/span><a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3Adocs.oracle.com+javase+docs+api+string\"><span class=\"kw3\">String<\/span><\/a>, String<span class=\"sy0\">&gt;<\/span> factory<span class=\"sy0\">=<\/span><span class=\"kw1\">new<\/span> ConcurrentKafkaListenerContainerFactory<span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; factory.<span class=\"me1\">setConsumerFactory<\/span><span class=\"br0\">&#40;<\/span>consumerFactory<span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw1\">return<\/span> factory<span class=\"sy0\">;<\/span><br \/>\n<br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n<span class=\"br0\">&#125;<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>The idea is to use this just to consume, but I added a REST interface for producing a message and a @PostConstruct method in the service to produce Sense Hat data, to be able to test if I don\u2019t have the Sense Hat producer.<\/p>\n<p>I\u2019m using this <a href=\"https:\/\/github.com\/cinci\/rpi-sense-hat-java\" rel=\"noopener\" target=\"_blank\">Java Wrapper for Raspberry Pi Sense Hat<\/a><\/p>\n<div class=\"codecolorer-container java blackboard\" style=\"overflow:auto;white-space:nowrap;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/><\/div><\/td><td><div class=\"java codecolorer\">&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">&lt;<\/span>dependency<span class=\"sy0\">&gt;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">&lt;<\/span>groupId<span class=\"sy0\">&gt;<\/span>sensehat<span class=\"sy0\">&lt;\/<\/span>groupId<span class=\"sy0\">&gt;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">&lt;<\/span>artifactId<span class=\"sy0\">&gt;<\/span>sensehat<span class=\"sy0\">&lt;\/<\/span>artifactId<span class=\"sy0\">&gt;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">&lt;<\/span>version<span class=\"sy0\">&gt;<\/span>1.0.0<span class=\"sy0\">&lt;\/<\/span>version<span class=\"sy0\">&gt;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">&lt;<\/span>scope<span class=\"sy0\">&gt;<\/span>system<span class=\"sy0\">&lt;\/<\/span>scope<span class=\"sy0\">&gt;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">&lt;<\/span>systemPath<span class=\"sy0\">&gt;<\/span>$<span class=\"br0\">&#123;<\/span>basedir<span class=\"br0\">&#125;<\/span><span class=\"sy0\">\/<\/span>lib<span class=\"sy0\">\/<\/span>java<span class=\"sy0\">-<\/span>executor<span class=\"sy0\">-<\/span><span class=\"nu0\">1.0<\/span><span class=\"sy0\">-<\/span>SNAPSHOT.<span class=\"me1\">jar<\/span><span class=\"sy0\">&lt;\/<\/span>systemPath<span class=\"sy0\">&gt;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">&lt;\/<\/span>dependency<span class=\"sy0\">&gt;<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<div class=\"codecolorer-container java blackboard\" style=\"overflow:auto;white-space:nowrap;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/>11<br \/>12<br \/>13<br \/>14<br \/>15<br \/>16<br \/><\/div><\/td><td><div class=\"java codecolorer\">@PostConstruct<br \/>\n&nbsp; &nbsp; <span class=\"kw1\">public<\/span> <span class=\"kw4\">void<\/span> init<span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw1\">if<\/span> <span class=\"br0\">&#40;<\/span>senseHat.<span class=\"me1\">equals<\/span><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;true&quot;<\/span><span class=\"br0\">&#41;<\/span><span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SenseHat senseHat <span class=\"sy0\">=<\/span> <span class=\"kw1\">new<\/span> SenseHat<span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw1\">new<\/span> <a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3Adocs.oracle.com+javase+docs+api+thread\"><span class=\"kw3\">Thread<\/span><\/a><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span> <span class=\"sy0\">-&gt;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw1\">while<\/span> <span class=\"br0\">&#40;<\/span><span class=\"kw2\">true<\/span><span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sendMessage<span class=\"br0\">&#40;<\/span><a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3Adocs.oracle.com+javase+docs+api+float\"><span class=\"kw3\">Float<\/span><\/a>.<span class=\"me1\">toString<\/span><span class=\"br0\">&#40;<\/span>senseHat.<span class=\"me1\">environmentalSensor<\/span>.<span class=\"me1\">getTemperature<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"br0\">&#41;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw1\">try<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3Adocs.oracle.com+javase+docs+api+thread\"><span class=\"kw3\">Thread<\/span><\/a>.<span class=\"me1\">sleep<\/span><span class=\"br0\">&#40;<\/span><span class=\"nu0\">5000<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span> <span class=\"kw1\">catch<\/span> <span class=\"br0\">&#40;<\/span><a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3Adocs.oracle.com+javase+docs+api+interruptedexception\"><span class=\"kw3\">InterruptedException<\/span><\/a> e<span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.<span class=\"me1\">printStackTrace<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><span class=\"br0\">&#41;<\/span>.<span class=\"me1\">start<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>And I have <em>kafka.sensehat=true<\/em> properties to enable or disable the Sense Hat producer<\/p>\n<p>You can get the full code on my <a href=\"https:\/\/github.com\/igfasouza\/Kafka-Spring-dashboard\" rel=\"noopener\" target=\"_blank\">GitHub<\/a>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/Screenshot-2021-05-31-at-16.25.44.png\" alt=\"\" width=\"2382\" height=\"1210\" class=\"alignnone size-full wp-image-1299\" srcset=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/Screenshot-2021-05-31-at-16.25.44.png 2382w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/Screenshot-2021-05-31-at-16.25.44-300x152.png 300w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/Screenshot-2021-05-31-at-16.25.44-1024x520.png 1024w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/Screenshot-2021-05-31-at-16.25.44-768x390.png 768w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/Screenshot-2021-05-31-at-16.25.44-1536x780.png 1536w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/07\/Screenshot-2021-05-31-at-16.25.44-2048x1040.png 2048w\" sizes=\"auto, (max-width: 2382px) 100vw, 2382px\" \/><br \/>\n<small>Picture 4: The end result<\/small><\/p>\n<p><iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/qM_gNH2pOEY\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<h2>Kafka<\/h2>\n<div class=\"codecolorer-container java blackboard\" style=\"overflow:auto;white-space:nowrap;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"java codecolorer\">.<span class=\"sy0\">\/<\/span>bin<span class=\"sy0\">\/<\/span>zookeeper<span class=\"sy0\">-<\/span>server<span class=\"sy0\">-<\/span>start.<span class=\"me1\">sh<\/span> .<span class=\"sy0\">\/<\/span>config<span class=\"sy0\">\/<\/span>zookeeper.<span class=\"me1\">properties<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<div class=\"codecolorer-container java blackboard\" style=\"overflow:auto;white-space:nowrap;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"java codecolorer\">.<span class=\"sy0\">\/<\/span>bin<span class=\"sy0\">\/<\/span>kafka<span class=\"sy0\">-<\/span>server<span class=\"sy0\">-<\/span>start.<span class=\"me1\">sh<\/span> .<span class=\"sy0\">\/<\/span>config<span class=\"sy0\">\/<\/span>server.<span class=\"me1\">properties<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<div class=\"codecolorer-container java blackboard\" style=\"overflow:auto;white-space:nowrap;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"java codecolorer\">.<span class=\"sy0\">\/<\/span>bin<span class=\"sy0\">\/<\/span>kafka<span class=\"sy0\">-<\/span>topics.<span class=\"me1\">sh<\/span> <span class=\"sy0\">--<\/span>create <span class=\"sy0\">--<\/span>zookeeper localhost<span class=\"sy0\">:<\/span><span class=\"nu0\">2181<\/span> <span class=\"sy0\">--<\/span>replication<span class=\"sy0\">-<\/span>factor <span class=\"nu0\">1<\/span> <span class=\"sy0\">--<\/span>partitions <span class=\"nu0\">1<\/span> <span class=\"sy0\">--<\/span>topic temperature<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<h2>Links<\/h2>\n<p><a href=\"http:\/\/www.igfasouza.com\/blog\/what-is-kafka\/\" rel=\"noopener\" target=\"_blank\">http:\/\/www.igfasouza.com\/blog\/what-is-kafka\/<\/a><\/p>\n<p><a href=\"http:\/\/www.igfasouza.com\/blog\/sense-hat\/\" rel=\"noopener\" target=\"_blank\">http:\/\/www.igfasouza.com\/blog\/sense-hat\/<\/a><\/p>\n<p><a href=\"http:\/\/www.igfasouza.com\/blog\/kafka-weather-station\/\" rel=\"noopener\" target=\"_blank\">http:\/\/www.igfasouza.com\/blog\/kafka-weather-station\/<\/a><\/p>\n<p><a href=\"http:\/\/www.igfasouza.com\/blog\/websockets-vs-server-sent-events\/\" rel=\"noopener\" target=\"_blank\">http:\/\/www.igfasouza.com\/blog\/websockets-vs-server-sent-events\/<\/a><\/p>\n<p><a href=\"http:\/\/www.igfasouza.com\/blog\/kafka-support-in-spring\/\" rel=\"noopener\" target=\"_blank\">http:\/\/www.igfasouza.com\/blog\/kafka-support-in-spring\/<\/a><\/p>\n<p><a href=\"https:\/\/github.com\/igfasouza\/Kafka-weather-station\" rel=\"noopener\" target=\"_blank\">https:\/\/github.com\/igfasouza\/Kafka-weather-station<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How goes the battle? This post is another part of my Kafka weather station use case idea. I want to show how I created an app using Spring Boot and Thymeleaf to show a real-time dashboard with Sense Hat temperature&hellip; <a href=\"http:\/\/www.igfasouza.com\/blog\/kafka-weather-real-time-dashboard-with-spring-thymeleaf\/\" class=\"more-link\">Continue Reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":1295,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,25,24],"tags":[17,7,13],"class_list":["post-1293","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","category-kafka","category-raspberry-pi","tag-java","tag-kafka","tag-raspberry-pi"],"_links":{"self":[{"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/posts\/1293","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=1293"}],"version-history":[{"count":6,"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/posts\/1293\/revisions"}],"predecessor-version":[{"id":1303,"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/posts\/1293\/revisions\/1303"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/media\/1295"}],"wp:attachment":[{"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/media?parent=1293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/categories?post=1293"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/tags?post=1293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}