<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Arvindh on Medium]]></title>
        <description><![CDATA[Stories by Arvindh on Medium]]></description>
        <link>https://medium.com/@arvindh123?source=rss-b45a19160ce8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ld1xEbbm290xUskd-jphFg.jpeg</url>
            <title>Stories by Arvindh on Medium</title>
            <link>https://medium.com/@arvindh123?source=rss-b45a19160ce8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 11:46:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@arvindh123/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Magistrala: Modular IoT at Planet Scale, Powered by SuperMQ]]></title>
            <link>https://medium.com/abstract-machines-blog/magistrala-modular-iot-at-planet-scale-powered-by-supermq-ace777c58a2e?source=rss-b45a19160ce8------2</link>
            <guid isPermaLink="false">https://medium.com/p/ace777c58a2e</guid>
            <category><![CDATA[event-driven-architecture]]></category>
            <category><![CDATA[best-iot-platforms]]></category>
            <category><![CDATA[planet-scale]]></category>
            <category><![CDATA[event-driven-systems]]></category>
            <dc:creator><![CDATA[Arvindh]]></dc:creator>
            <pubDate>Wed, 10 Dec 2025 17:00:29 GMT</pubDate>
            <atom:updated>2025-12-13T22:55:25.736Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3NhsAgZTEFQTuEu6UWAS3Q.png" /></figure><h4><a href="https://magistrala.absmach.eu/">Magistrala</a> is a modular, domain-centric IoT platform built for a world where billions of devices stream events in real time. At its core is <a href="https://github.com/absmach/supermq"><strong>SuperMQ</strong></a>, a high-performance, protocol-agnostic messaging backbone that unifies sensors, services, and digital twins into a single event mesh. Together, they turn fragmented IoT stacks into a coherent, secure, and reactive infrastructure designed for planet-scale systems.</h4><p>In an era defined by hyper-connectivity — where billions of devices, applications, and services continuously generate and respond to data — systems must do more than just scale. They must <strong>react instantly, adapt intelligently, and operate reliably at global scale</strong>.</p><p>This is where <a href="https://www.absmach.eu/"><strong>Magistrala</strong></a> comes in — a modular, domain-centric <strong>IoT platform</strong> purpose-built to orchestrate, enrich, and persist event flows across heterogeneous systems. <strong>At its core lies </strong><a href="https://github.com/absmach/supermq"><strong>SuperMQ</strong></a>, a <strong>high-performance</strong>, <strong>protocol-agnostic</strong>, <strong>event-driven messaging backbone</strong> engineered from first principles to support universal-scale, real-time communication with uncompromising reliability.</p><p>Built for <strong>planet-scale resilience</strong>, <strong>protocol interoperability</strong>, and <strong>strict multi-tenant isolation</strong>, SuperMQ and Magistrala form the core infrastructure for crafting unified, real-time event ecosystems. Whether you’re streaming data from a single sensor or orchestrating a global mesh of systems, this architecture delivers a <strong>universal event mesh</strong> — one that simplifies complexity, ensures security, and bridges domains, protocols, and devices effortlessly.</p><h3>SuperMQ: The Universal Event Backbone</h3><p><strong>SuperMQ</strong> is not just another message broker. It’s a purpose-built, <strong>lightweight</strong>, and <strong>high-throughput</strong> messaging engine that serves as the <strong>event-driven nervous system</strong> of modern digital infrastructure.</p><p>SuperMQ empowers an ecosystem of interconnected clients — whether sensors, microservices, applications, or digital twins — with real-time communication and autonomous behavior.</p><p>It is designed around three core pillars:</p><h3>1. Protocol Agnosticism</h3><p>Communication should transcend transport boundaries. SuperMQ natively supports:</p><ul><li><strong>MQTT</strong>: Optimized for low-bandwidth, low-power IoT devices</li><li><strong>HTTP/REST</strong>: Ideal for stateless API integrations</li><li><strong>WebSocket</strong>: Enables real-time, bidirectional communication</li><li><strong>CoAP</strong>: Perfect for constrained embedded environments</li></ul><p>This allows clients of all shapes and capabilities to seamlessly interoperate over a unified fabric.</p><h3>2. First-Class Topics via Channels</h3><p>Instead of loosely-defined topics, SuperMQ introduces <strong>Channels</strong> — explicitly permissioned, strongly-typed message paths. Channels provide:</p><ul><li><strong>Fine-grained access control</strong></li><li><strong>Predictable routing and behavior</strong></li><li><strong>Better observability and auditing</strong></li></ul><p>This abstraction elevates channels from passive data conduits to secure, composable building blocks of event flows.</p><h3>3. Event-Driven By Design</h3><p>SuperMQ assumes a world where <strong>data is pushed, not pulled</strong>. Events are treated as first-class citizens, enabling clients to:</p><ul><li><strong>React to state changes immediately</strong></li><li><strong>Automate workflows dynamically</strong></li><li><strong>Compose complex behaviors from modular event handlers</strong></li></ul><p>This leads to systems that are more <strong>responsive, autonomous, and scalable</strong> — moving away from brittle request-response models toward true reactivity.</p><h3>Messaging Mechanics: Clients, Channels, and Topics</h3><p>In SuperMQ, every message transmission follows a strict permissioned path between a <strong>Client</strong> and a <strong>Channel</strong>.</p><ul><li>A <strong>Client</strong> is any entity capable of publishing or subscribing to messages — IoT device, backend service, browser app, etc.</li><li>Clients are protocol-agnostic — they connect via <strong>MQTT</strong>, <strong>HTTP</strong>, <strong>WebSocket</strong>, or <strong>CoAP</strong>.</li><li>A <strong>Channel</strong> is a logically defined conduit through which messages flow.</li></ul><p>Channels are logical conduits where messages are published and subscribed. Unlike arbitrary topics, channels in SuperMQ are <strong>first-class entities</strong> with controlled access.</p><p>Clients do not communicate with each other directly. Instead, they interact with channels using two permission modes:</p><ul><li><strong>Publish</strong> (write to a channel)</li><li><strong>Subscribe</strong> (read from a channel)</li></ul><p>In simple words Clients cannot just talk to each other arbitrarily. Instead:</p><ul><li>They <strong>publish</strong> messages to a Channel.</li><li>Other Clients <strong>subscribe</strong> to the Channel and receive messages that match their topic filters and permissions.</li></ul><blockquote><em>This model enforces </em><strong><em>decoupling by design</em></strong><em> — the publisher does not need to know who the subscribers are, and vice versa.</em></blockquote><p>Clients must have explicit permission to interact with a channel. These connections are defined as <strong>Client-Channel Connections</strong>.</p><h3>Topic Format</h3><p>SuperMQ uses a well-structured topic hierarchy:</p><pre>m/&lt;domain_id&gt;/c/&lt;channel_id&gt;/&lt;subtopic&gt;/&lt;subtopic&gt;/…</pre><p>This topic format enables:</p><ul><li><strong>Domain-level isolation</strong></li><li><strong>Channel-level permission enforcement</strong></li><li><strong>Granular subtopic routing</strong></li></ul><p>This is not just namespacing — it’s an <strong>addressing scheme for planet-scale event systems</strong>.</p><h3>Seamless Cross-Protocol Messaging</h3><p>What makes SuperMQ truly stand apart is its <strong>protocol-agnostic delivery</strong> model.</p><blockquote><em>Imagine an industrial sensor connected via </em><strong><em>MQTT</em></strong><em> publishing data, while a cloud dashboard built on </em><strong><em>WebSocket</em></strong><em> receives it in real time — both speaking through the same Channel.</em></blockquote><p>This isn’t theory SuperMQ enables:</p><ul><li>Protocol <strong>interoperability</strong> out-of-the-box</li><li>Transparent <strong>message normalization</strong></li><li>End-to-end <strong>semantic integrity</strong></li></ul><p>It’s a true <strong>universal event bus</strong> — where transport becomes an implementation detail, not a barrier.</p><h3>Group-Based Modeling: Structure at Scale</h3><p>SuperMQ introduces the concept of <strong>Groups</strong> to model logical, operational, or organizational hierarchies:</p><ul><li>Groups can <strong>contain Clients and Channels</strong>.</li><li>Groups can have <strong>parent-child relationships</strong>, forming trees or even DAGs of responsibility.</li><li>Access can be managed <strong>per group</strong>, enabling permission inheritance and delegation.</li></ul><p>This structure is essential when managing:</p><ul><li>Thousands to millions of devices</li><li>Access across departments, regions, or customer accounts</li><li>Dynamic role-based systems (e.g., operators, maintainers, services)</li></ul><p>Groups are the <strong>organizational unit of scale</strong>, much like <strong>pods in Kubernetes</strong> or <strong>tenants in cloud platforms</strong>.</p><h3>Domains: The Fabric of Multi-Tenancy</h3><p>At the highest level, SuperMQ introduces the concept of a <strong>Domain</strong>.</p><ul><li>A Domain is an isolated namespace and policy boundary.</li><li>All entities — Clients, Channels, Groups — <strong>exist within a domain</strong>.</li><li>No entity from one domain can affect or access another — unless explicitly bridged.</li></ul><p>This forms the basis of <strong>multi-tenant infrastructure</strong> — allowing SuperMQ to serve multiple products, customers, or business units in complete isolation, with shared infrastructure.</p><blockquote><em>Think of each domain as a </em><strong><em>universe</em></strong><em> within a multiverse of event systems.</em></blockquote><h3><strong>Magistrala: From Transport to Transformation</strong></h3><p>If <strong>SuperMQ is the transport layer</strong>, then <strong>Magistrala is the application and intelligence layer</strong>.</p><p>Magistrala is not just a control plane. It is a <strong>modular, event-aware automation engine</strong> that transforms event streams into structured outcomes — by <strong>processing, enriching, persisting, visualizing, and reacting to messages</strong> flowing through SuperMQ.</p><p><strong>What Magistrala Adds to SuperMQ</strong></p><p><strong>🔁 Writers &amp; Readers</strong></p><ul><li><strong>Writers</strong>: Persist messages to databases (internal or external).</li><li><strong>Readers</strong>: Serve historical data for dashboards, reports, or external queries.</li></ul><p>These components provide a <strong>decoupled data plane</strong> that supports both short-term analytics and long-term storage.</p><p><strong>⚙️ Rule Engine</strong></p><p>The <strong>Rule Engine</strong> is the brain of Magistrala. It enables <strong>event transformation, routing, and enrichment</strong> based on programmable logic.</p><ul><li><strong>Input Block</strong>: Define channels and subtopics to listen to.</li><li><strong>Logic Block</strong>: Choose from prebuilt logic (e.g., comparators) or write custom <strong>Lua scripts</strong> to handle binary payloads, complex conditions, or protocol transformations.</li><li><strong>Output Block</strong>: Route results to databases, alarms, dashboards, or even re-publish to other channels.</li></ul><p>Rules can be chained, dynamically updated, and scheduled — turning Magistrala into a <strong>dataflow engine</strong>.</p><p><strong>🔔 Alarms</strong></p><ul><li>Define rules that trigger alarms based on thresholds or conditions.</li><li>View, acknowledge, and manage alarms in real time.</li><li>Use alarms to drive notifications, workflows, or escalation pipelines.</li></ul><p><strong>📊 Reports</strong></p><ul><li>Create <strong>HTML-based templates</strong> for scheduled or on-demand reports.</li><li>Bind templates to queries over the persisted data.</li><li>Export as <strong>PDF</strong>, download, or auto-email on a <strong>cron-like scheduler</strong>.</li></ul><p>This is critical for operational reporting, compliance, auditing, and real-time summaries.</p><p><strong>🧱 Dashboards</strong></p><ul><li>Drag-and-drop dashboard builder (Grafana-like).</li><li>Visualize live and historical data with charts, tables, gauges, and maps.</li><li>Powered entirely by the <strong>Reader interface</strong> — no custom frontend coding needed.</li></ul><p><strong>One Unified Event Mesh</strong></p><p>Together, SuperMQ and Magistrala deliver a <strong>cohesive, production-grade platform</strong> for:</p><ul><li>Smart factories</li><li>Digital twins</li><li>Remote monitoring and control</li><li>Predictive maintenance</li><li>Energy and utility networks</li><li>Enterprise automation</li></ul><p>This isn’t a collection of microservices duct-taped together.</p><p>This is a <strong>co-designed system architecture</strong> where:</p><ul><li>SuperMQ ensures high-speed, secure delivery of events</li><li>Magistrala processes, stores, reacts to, and visualizes those events in real time</li></ul><h3>Try It. Fork It. Build on It.</h3><p>Magistrala and SuperMQ are fully open-source, designed for real-time IoT at any scale. Run them, break them, improve them.</p><p><strong>Magistrala</strong> → <a href="https://github.com/absmach/magistrala">https://github.com/absmach/magistrala</a><br> <strong>SuperMQ</strong> → <a href="https://github.com/absmach/supermq">https://github.com/absmach/supermq</a></p><p>Join the community and help build the universal event mesh for connected systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ace777c58a2e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/abstract-machines-blog/magistrala-modular-iot-at-planet-scale-powered-by-supermq-ace777c58a2e">Magistrala: Modular IoT at Planet Scale, Powered by SuperMQ</a> was originally published in <a href="https://medium.com/abstract-machines-blog">Abstract Machines Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Streaming Database Queries in Go 1.23 Using Iterators (range over Seq2)]]></title>
            <link>https://medium.com/@arvindh123/streaming-database-queries-in-go-1-23-using-iterators-range-over-seq2-b4661644c0b5?source=rss-b45a19160ce8------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4661644c0b5</guid>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[golang-development]]></category>
            <category><![CDATA[golang-tutorial]]></category>
            <dc:creator><![CDATA[Arvindh]]></dc:creator>
            <pubDate>Fri, 21 Nov 2025 03:57:31 GMT</pubDate>
            <atom:updated>2025-11-21T03:57:31.774Z</atom:updated>
            <content:encoded><![CDATA[<p>Go 1.23 quietly delivered one of the most powerful features for backend developers:<br> <strong>native support for iterators using </strong><strong>range over functions</strong>.</p><p>This opens the door to a new style of writing clean, efficient, streaming-friendly code — especially for <strong>database queries</strong>. If you’ve ever struggled with loading large result sets into memory or writing repetitive for rows.Next() boilerplate, this article is for you.</p><p>Let’s explore how the new iterator pattern works and why it’s a game-changer for database access.</p><h3>🌟 Why Iterators Matter for Databases</h3><p>Traditional Go database access looks like this:</p><pre>rows, _ := db.Query(&quot;SELECT id, name FROM users&quot;)<br>for rows.Next() {<br>    var u User<br>    rows.Scan(&amp;u.ID, &amp;u.Name)<br>    ...<br>}</pre><p>This works, but:</p><ul><li>It’s verbose</li><li>Errors must be handled manually</li><li>You may accidentally forget to close rows</li><li>Large queries can consume huge amounts of memory</li><li>You must load everything if your function returns a slice</li></ul><p>Go 1.23 fixes all of this with a beautiful new mechanism:</p><pre>for item, err := range SomeIterator() {<br>    ...<br>}</pre><p>When combined with database queries, this unlocks <strong>streaming</strong> — processing large datasets without ever storing them in memory.</p><h3>🧩 Meet Seq2: The Go 1.23 Iterable Function</h3><p>A <strong>rangeable iterator</strong> in Go is simply a function:</p><pre>type Seq2[K, V any] func(func(K, V) bool)</pre><p>The function takes a “yield” callback.<br> Your function provides items to the callback, one at a time.</p><p>Go 1.23 automatically turns this into something you can range over.</p><h3>🔥 Building a Database Iterator (Real Example)</h3><p>Let’s create a database iterator that streams rows from a query.</p><h3>🔷 Step 1 — Define the iterator type</h3><pre>type Seq2[K, V any] func(func(K, V) bool)</pre><h3>🔷 Step 2 — Wrap your database query</h3><pre>func Users(ctx context.Context, db *sql.DB) Seq2[User, error] {<br>    return func(yield func(User, error) bool) {<br>        rows, err := db.QueryContext(ctx, `SELECT id, name FROM users`)<br>        if err != nil {<br>            yield(User{}, err)<br>            return<br>        }<br>        defer rows.Close()<br>        for rows.Next() {<br>            var u User<br>            if err := rows.Scan(&amp;u.ID, &amp;u.Name); err != nil {<br>                yield(User{}, err)<br>                return<br>            }<br>            if !yield(u, nil) { // stop if caller returned false<br>                return<br>            }<br>        }<br>        if err := rows.Err(); err != nil {<br>            yield(User{}, err)<br>        }<br>    }<br>}</pre><h3>🔷 Step 3 — Use it with range (Go 1.23+)</h3><pre>for user, err := range Users(ctx, db) {<br>    if err != nil {<br>        log.Println(&quot;Error:&quot;, err)<br>        break<br>    }<br>    fmt.Println(&quot;User:&quot;, user.ID, user.Name)<br>}</pre><p>That’s it.<br> You now have:</p><ul><li>Zero memory overhead</li><li>Automatic row cleanup</li><li>Error-safe iteration</li><li>A clean, modern Go API</li></ul><h3>🚀 Why This Pattern Is So Powerful</h3><h3>✔ Streams data instead of loading everything</h3><p>Process millions of rows with constant memory usage.</p><h3>✔ Eliminates boilerplate</h3><p>No more:</p><pre>rows.Next()<br>rows.Scan(...)<br>rows.Close()</pre><p>The iterator handles it.</p><h3>✔ Natural early stopping</h3><pre>for user, _ := range Users(ctx, db) {<br>    if user.ID == 100 { break }<br>}</pre><p>The iterator stops fetching immediately.</p><h3>✔ Works with worker pools and goroutines</h3><pre>for user, _ := range Users(ctx, db) {<br>    go process(user)<br>}</pre><h3>✔ Perfect for microservices</h3><p>Stream directly to:</p><ul><li>WebSocket</li><li>SSE</li><li>gRPC streaming</li><li>Python consumer</li><li>Kafka producer</li></ul><h3>💡 Bonus: Parameterized Database Iterators</h3><p>You can easily build specialized streaming queries:</p><pre>func UsersByRole(ctx context.Context, role string, db *sql.DB) Seq2[User, error]</pre><p>Use it like:</p><pre>for u, err := range UsersByRole(ctx, &quot;admin&quot;, db) {<br>    ...<br>}</pre><h3>🧱 Advanced: Prefetching &amp; Backpressure</h3><p>Because iterators yield items one-by-one, you can easily add:</p><ul><li>batching</li><li>rate-limiting</li><li>concurrency</li><li>cancellation through context</li></ul><p>The iterator pattern works beautifully with streaming architectures.</p><h3>🏁 Final Thoughts</h3><p><strong>Go 1.23’s iterator support is one of the most underrated features in recent Go history.</strong></p><p>When combined with database access, it gives you:</p><ul><li>Cleaner code</li><li>Faster processing</li><li>Zero memory overhead</li><li>Automatic cleanup</li><li>Idiomatic Go syntax</li></ul><p>Instead of writing database loops manually, you now write expressive, readable code like:</p><pre>for user, err := range Users(ctx, db) {<br>    ...<br>}</pre><p>Your future self (and your team) will thank you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4661644c0b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>