Generate Factory Data Stream with n8n and AMQP

This workflow automates the generation and streaming of simulated factory machine data using n8n’s interval trigger and AMQP nodes, helping factories test IoT data pipelines efficiently.
set
interval
amqp
Learn how to Build this Workflow with AI:
Workflow Identifier: 2402
NODES in Use: set, interval, amqp

Press CTRL+F5 if the workflow didn't load.

Visit through Desktop for Best experience

1. Opening Problem Statement

Meet Lisa, an industrial IoT engineer working for a manufacturing plant in Berlin. She needs to rigorously test the factory’s new data ingestion system that collects machine telemetry like temperature and uptime. Without real-time data, Lisa faces a major roadblock: how to simulate continuous, realistic machine data streams that mimic the actual factory environment. Manually generating data points is tedious, error-prone, and time-consuming, causing workflow delays and raising risks of undetected bugs in the final system. Lisa needs an automated, reliable way to generate and send factory data frequently so she can efficiently validate her systems and avoid costly production failures.

2. What This Automation Does

This n8n workflow automates the generation and delivery of synthetic machine telemetry data, specifically temperature and uptime metrics, emitted at regular intervals to an AMQP message broker. When active, it performs these key functions:

  • Periodically triggers data creation every set time period (configurable).
  • Simulates machine sensor readings by generating random temperature (0-99 °C) and uptime values.
  • Timestamps the readings precisely to mimic real-time streaming.
  • Packages the data into JSON objects labeled with a machine identifier.
  • Pushes this simulated data continuously to an AMQP sink (message queue) named “berlin_factory_01”.
  • Enables reliable IoT testing by providing a consistent, automated source of realistic factory data.

Overall, this saves Lisa hours of manual data preparation and prevents errors that could otherwise cause costly system failures during live deployment.

3. Prerequisites ⚙️

  • n8n account (cloud or self-hosted) with workflow creation access.
  • AMQP broker credentials for sending messages (e.g., RabbitMQ server access with queue named “berlin_factory_01”).
  • Basic familiarity with n8n’s interface, especially Interval, Set, and AMQP nodes.
  • Optional: Development environment to verify the AMQP queue receives messages.

4. Step-by-Step Guide

Step 1: Start a New Workflow & Add an Interval Trigger Node

Open your n8n editor, click Create Workflow. From the nodes panel, drag the Interval node onto the canvas. This node triggers the workflow at defined regular intervals.

In the Interval node parameters, leave default settings or set a custom time interval like “Every 10 seconds” depending on how often you want data generated.

You should see the node configured to emit a trigger every X seconds/minutes. This starts the automation cycle each time.

Step 2: Add a Set Node to Generate Data

Drag a Set node next to the Interval node. Connect the Interval’s output to the Set node’s input. The Set node creates the data payload.

Configure the Set node’s parameters to assign values:

  • Set machine_id.name to “n8n_cr8” (a factory machine identifier).
  • Set temperature_celsius to a JavaScript expression {{$Math.floor(Math.random() * 100)}} which randomly generates a value from 0 to 99.
  • Set machine_id.uptime to {{$Math.floor(Math.random() * 100)}} for uptime simulation.
  • Set time_stamp to {{$Date.now()}} for the current timestamp.

Make sure you enter the expressions with the double curly braces and equal symbol = to compute them at runtime properly.

Step 3: Add an AMQP Sender Node for Message Queuing

Add an AMQP node to the right of the Set node, connect Set output to AMQP input.

Set the sink parameter to berlin_factory_01, which is the target message queue on your RabbitMQ or AMQP broker.

Configure AMQP credentials by selecting or entering your broker connection details with host, port, username, and password.

This node will push the generated JSON data to the queue for downstream processing.

Step 4: Test the Workflow

Activate the workflow and monitor the AMQP queue or consumer application to verify messages arrive continuously with machine telemetry data.

Typical output example: { "machine_id": { "name": "n8n_cr8", "uptime": 72 }, "temperature_celsius": 54, "time_stamp": 1685203200000 }

Common Mistakes

  • Not using the proper expression syntax in the Set node, causing static values instead of dynamic random data.
  • Mismatched AMQP credentials preventing message delivery.
  • Wrong queue name in the AMQP node causing messages to get lost or rejected.

5. Customizations ✏️

  • Adjust Data Frequency: In the Interval node, change the trigger interval to generate data as fast or slow as needed by your testing requirements.
  • Add More Machine Metrics: In the Set node, add new fields like pressure_psi or vibration_level with random expressions to extend simulation.
  • Use Different AMQP Queues: Modify the AMQP sink parameter to target other queues, enabling testing multiple factory lines.
  • Include Data Formatting: Insert a Function node between Set and AMQP to format or enrich data before sending.
  • Enable Conditional Triggers: Use a Switch node after Interval to trigger data generation only during specific time windows.

6. Troubleshooting 🔧

  • Problem: “AMQP connection refused or authentication failed.”

    Cause: Incorrect AMQP credentials or broker unreachable.

    Solution: Double-check AMQP host, port, username, and password in the credential settings. Test connection with other AMQP tools.
  • Problem: “Set node expressions not evaluated, static values sent.”

    Cause: Missing correct expression syntax = and curly braces in the Set node variables.

    Solution: Edit Set node fields to use the format ={{Math.floor(Math.random() * 100)}} ensuring runtime evaluation.
  • Problem: “No messages arriving in AMQP queue despite workflow running.”

    Cause: Wrong queue name or network issues.

    Solution: Verify the queue name exactly matches the one configured on your AMQP broker. Ensure your broker is accessible.

7. Pre-Production Checklist ✅

  • Verify AMQP broker is running and accessible.
  • Ensure credentials in n8n are valid and tested.
  • Confirm Interval node interval matches desired test frequency.
  • Confirm Set node expressions correctly generate random values.
  • Test receipt of data by consuming the AMQP messages.
  • Backup your workflow in n8n before deployment.

8. Deployment Guide

Once tested, enable the workflow in n8n to run continuously. Monitor the AMQP queue to ensure steady data stream without interruptions. Use n8n’s execution logs to troubleshoot any runtime errors. If self-hosting n8n, ensure the instance uptime and network connectivity to the AMQP broker remain stable.

9. FAQs

  • Q: Can this workflow send data to other message brokers besides AMQP?
    A: This specific setup uses the AMQP node but you can replace it with nodes for MQTT, Kafka, or HTTP requests to support other protocols.
  • Q: Does generating random data consume much system resources?
    A: No, this workflow is lightweight, generating small JSON payloads at intervals, suitable for continuous testing.
  • Q: Can I simulate multiple machines simultaneously?
    A: Yes, by duplicating the Set node with different machine IDs or by generating arrays of machine data in one Set node.

10. Conclusion

By building Lisa’s automated factory data generator, you’ve created a smart way to simulate continuous machine telemetry for IoT system testing. This workflow saves hours of manual data entry, reduces mistakes, and ensures reliable validation for production readiness. Next, consider extending this setup to include alerting via email or Slack based on specific data thresholds, or integrating with real-time dashboards for live monitoring. Your journey into industrial IoT automation just took a big leap forward!

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation in n8n (Beginner Guide)

A complete beginner guide to building an AI-powered SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free