GithubHelp home page GithubHelp logo

emqx / mqtt-to-kafka Goto Github PK

View Code? Open in Web Editor NEW
9.0 9.0 2.0 117 KB

Streaming IoT data into Confluent/Kafka using MQTT and EMQX | MQTT Kafka Integration

Home Page: https://www.emqx.com/en/blog/mqtt-and-kafka

License: Apache License 2.0

Makefile 100.00%
emqx iot iov mqtt-kafka streaming-integration emqx-data-integration mqtt-kafka-integration real-time-data-processing

mqtt-to-kafka's Introduction

mqtt-to-kafka

Streaming IoT data into Confluent/Kafka using MQTT and EMQX | MQTT Kafka Integration.

Introduction

Kafka and MQTT are complementary technologies that enable end-to-end integration of IoT data. By integrating Kafka and MQTT, businesses can establish a robust IoT architecture that guarantees reliable connectivity and efficient data exchange between devices and IoT platforms. At the same time, it also facilitates high throughput real-time data processing and analysis throughout the entire IoT system.

There are many IoT use cases where integrating MQTT and Kafka provides significant value, such as Connected Cars and Telematics, Smart City Infrastructure, Industrial IoT Monitoring, Logistics Management, etc.

This is a demo project that shows how to use EMQX and Kafka to build a streaming data pipeline. The project uses MQTTX CLI to simulate the MQTT client to publish vehicle data to EMQX, and then uses EMQX Data Integration to streaming the data to Kafka.

Architecture

MQTT to Kafka Architecture

Name Version Description
EMQX Enterprise 5.0.4+ MQTT broker used for message exchange between MQTT clients and the Kafka system.
MQTTX CLI 1.9.3+ Command-line tool used to generate simulated data for testing.
Kafka 2.8.0+ Distributed streaming platform for collecting, storing, and processing data.
EMQX Exporter 0.1 Prometheus exporter for EMQX
Prometheus v2.44.0 Open-source systems monitoring and alerting toolkit.
Grafana 9.5.1+ Visualization platform utilized to display and analyze the collected data.

Note: In this project we refer to kafka-docker.

How to use

  1. Init the submodule to get the EMQX Exporter (Optional):
git submodule init
git submodule update
  1. Please make sure you have installed the docker, and then running the following commands to start the demo:
docker-compose up -d

You can quickly init submodule and start the demo by using the make command as well.

  1. Running the following commands to see the message from MQTTX:
docker logs -f mqttx
  1. Running the following commands to see the message from kafka consumer:
docker exec -it kafka \
  kafka-console-consumer.sh \
  --topic my-vehicles \
  --from-beginning \
  --bootstrap-server localhost:9092

You can see the message from Kafka consumer:

{"vin":"EDF226K7LZTZ51222","speed":39,"odometer":68234,"soc":87,"elevation":4737,"heading":33,"accuracy":24,"power":97,"shift_state":"D","range":64,"est_battery_range":307,"gps_as_of":1681704127537,"location":{"latitude":"83.3494","longitude":"141.9851"},"timestamp":1681704127537}
  1. If you want to view the EMQX Metrics in Grafana dashboard, you can open http://localhost:3000 in your browser, and login with admin:public.

License

Apache License 2.0

mqtt-to-kafka's People

Contributors

emqplus avatar logo306142054 avatar rory-z avatar wivwiv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

ttgzs cemakpolat

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.