https://github.com/akmalmaulanabasri/mqtt_subscriber

https://github.com/akmalmaulanabasri/mqtt_subscriber

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.7%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: akmalmaulanabasri
  • Language: Rust
  • Default Branch: master
  • Size: 10.7 KB
Statistics
  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created 12 months ago · Last pushed 12 months ago
Metadata Files
Readme

README.md

📘 MQTT Logger in Rust

A simple MQTT subscriber built with Rust that listens to the /broker_alive topic and stores each incoming message as a JSON record in a local SQLite database.


🚀 Features

  • Connects to a private use proxies (172.10.20.4) MQTT broker (172.10.20.53)
  • Subscribes to the topic /broker_alive
  • Parses and validates JSON messages
  • Saves messages into a local SQLite database with:
    • Auto-incremented ID
    • Topic
    • JSON message
    • Timestamp (Unix epoch)

🧱 Tech Stack


📦 Installation

Prerequisites

  • Rust (version 1.60+)
  • SQLite (optional, for CLI inspection)

Clone and Run

bash git clone https://github.com/yourname/mqtt_logger_rust.git cd mqtt_logger_rust cargo run

📁 Project Structure

mqtt_logger_rust/ ├── Cargo.toml └── src/ └── main.rs

📝 Database Schema

The app creates a local file mqtt_logs.db with a messages table using the following schema: SQL CREATE TABLE IF NOT EXISTS messages ( id INTEGER PRIMARY KEY AUTOINCREMENT, topic TEXT NOT NULL, message TEXT NOT NULL, timestamp INTEGER NOT NULL );

💡 Usage

Once the application is running, it will: Connect to the MQTT broker Subscribe to /brokeralive Save all incoming valid JSON messages into the mqttlogs.db file

Example MQTT Message

JSON { "status": "alive", "service": "laundry_backend" }

📂 Dependencies

``` toml

[dependencies] rumqttc = "0.19" tokio = { version = "1", features = ["full"] } rusqlite = { version = "0.29", features = ["bundled"] } serde = { version = "1", features = ["derive"] } serde_json = "1.0" ```

Owner

  • Name: Akmal Maulana Basri
  • Login: akmalmaulanabasri
  • Kind: user
  • Location: Bogor, Indonesia

High School Student

GitHub Events

Total
  • Push event: 1
  • Create event: 2
Last Year
  • Push event: 1
  • Create event: 2

Dependencies

Cargo.lock cargo
  • 115 dependencies
Cargo.toml cargo