Sensor Simulator for Smart City System Development
This CLI provides a scalable simulation of sensors, supporting any type
and handling thousands of concurrent units
Table of Contents
Overview
In the process of developing systems that involve a large number of devices, such as sensors, there is a significant challenge in recreating an environment during development that closely resembles the production environment. This is not about load testing; it's about the need for a tool that can generically and highly scalably simulate a network of sensors deployed in a smart city. Congo addresses this by providing an intuitive CLI designed for use in such development environments.
Architecture

The CLI communicates with a MongoDB instance where metadata for the sensors to be simulated in the production environment is stored, including attributes such as latitude, longitude, and the intervals between the minimum and maximum values the sensor can generate and publish to the system. After allocating a virtual thread for each sensor registered in the database, the system concurrently publishes the data to a topic defined and configured via an MQTT HiveMQ broker.
The user can also make an HTTP request to the /sensor route to register a new sensor in the database, simultaneously creating a virtual thread to simulate its behavior. One potential solution for integrating this system with other services is leveraging the HiveMQ extension for Apache Kafka integration. This allows services to consume the data in an orderly fashion through a messaging queue.
Getting Started
Prerequisites
- Install Docker Desktop for your operating system.
- MQTT Broker
- MongoDB Instance
[!NOTE]
For a development environment, you can use the local infrastructure provided in this repository, which includes:
- MQTT HiveMQ broker with the Apache Kafka extension enabled.
- MongoDB instance that will be populated with the data from the provided file.
- Infrastructure for Apache Kafka.
To run this, simply clone this repository and execute the following command:
make infra
Running
[!WARNING]
Before running the command below, ensure you have created a Config.toml
file and set the environment variables correctly. If you are using the local infrastructure referenced earlier, use this file as a reference. Below is the structure of the content that should be included in the file:
[MONGO]
DB_URL=
DB_NAME=
COLLECTION_NAME=
[HIVEMQ]
SERVER_URL=
USERNAME=
PASSWORD=
- Run the CLI using the Docker image provided for distributing its binary. Use the following command:
docker run --rm \
-v $(pwd):/app -w /app \
ghcr.io/henriquemarlon/congo:latest \
--config <path-to-toml-file> --verbose
- Run tee CLI using the Go package:
go install github.com/henriquemarlon/congo/cmd/congo@latest