moonedge

    MoonBit multi-protocol edge data collection and processing framework

    Download zip
    Author
    Version
    0.1.0
    License
    Apache-2.0
    Last updated
    5 hours ago
    Downloads
    2

    #MoonEdge

    MoonBit framework for read-only edge device collection, normalization, validation, rules and bounded routing. MQTT, Modbus TCP, Modbus RTU and CoAP share one event model. Protocol logic and the gateway are MoonBit, with a small native serial layer.

    #Run locally

    Use MoonBit 1.0.0-rc1+3c0520448 or compatible newer toolchain, a native C compiler, and network access for the initial dependency download. The older 0.10.17 compiler cannot compile the selected MQTT dependency.

    git clone https://github.com/mik1e80/moonedge.git cd moonedge moon update moon run examples/mqtt_sensor --target native moon run examples/modbus_sensor --target native moon run examples/multi_protocol --target native

    These examples start deterministic wire peers on ephemeral loopback TCP ports. They need no external broker, hardware, Node.js or Python. The multi-protocol example receives three MQTT events and three Modbus events and verifies delivery.

    #Gateway CLI

    moon run cmd/moonedge --target native -- check-config examples/config/basic.json moon run cmd/moonedge --target native -- run examples/config/basic.json

    Events go to stdout or configured JSON Lines files; the final device/route report goes to stderr. Runs end at duration_ms (default 30 seconds) or when all sources are exhausted. Duration expiry cancels collection, closes sockets and drains accepted output queues within drain_timeout_ms (default 5 seconds). Entries still queued or in flight at the deadline count as drops. Ctrl+C uses the async runtime's resource cleanup; queued delivery during process cancellation is not guaranteed.

    For external services, use MQTT or Modbus configurations and read the protocol support matrix. MQTT authentication uses environment variable references, never literal passwords in configuration.

    #Implemented

    • MQTT 3.1.1 asynchronous subscriptions at QoS 0, clean sessions, keepalive, bounded frames, reconnect/resubscribe and retained messages before SUBACK.
    • Modbus TCP FC03/FC04, MBAP correlation, exception handling and U16/I16/U32/I32/F32 fields with configurable word order. No device writes.
    • Modbus RTU FC03/FC04 over Windows and Linux serial ports, with CRC validation and the same numeric layouts. See the serial setup guide.
    • CoAP UDP GET for JSON telemetry and local DNS-SD discovery.
    • Typed events, missing/zero distinction, explicit quality, source and timestamps.
    • Field conversion, scaling/units, validation, freshness, boolean rules and projection.
    • Concurrent devices, failure isolation, per-device lifetime retry budgets.
    • Independent bounded output queues, condition routing, fan-out and capped retries.
    • Console, append-only JSONL and extension traits for adapters/processors/sinks.
    • Strict JSON configuration, sanitized diagnostic categories and run statistics.

    #Checks

    moon run tools/check-key.mbtx moon run benchmarks/pipeline --target native --release moon info --target native

    The check script runs selected critical cases rather than the entire test suite. Actual evidence includes an independent Aedes MQTT broker exchange, 100-device concurrency and six-event dual-protocol JSONL delivery.

    #Boundaries

    Version 0.1.0 is a development baseline. Native backend is the supported gateway target. JSON Lines can use an offline spool. No TLS, arbitrary rule scripts, database, broker, industrial control, MQTT QoS1/2 ingestion or exactly-once delivery is provided. Queue overflow and retry exhaustion can lose data; sink retries can duplicate it. Deploy on trusted networks with external transport protection and device ACLs.

    Mooncakes publication is pending registry login. Do not treat this repository as proof of a published package or contest acceptance. See proposal and delivery tracker.

    Apache-2.0. Dependencies and conceptual references are recorded in THIRD_PARTY_NOTICES.md.