DEV Community

Pirate Prentice
Pirate Prentice

Posted on

n8n ActiveMQ Node: Publish and Consume Messages in Your Workflows [Free Workflow JSON]

If you're integrating n8n with an enterprise messaging stack, Apache ActiveMQ is one of the most common brokers you'll encounter. The n8n ActiveMQ node lets your workflows publish messages to queues or topics, and consume incoming messages as workflow triggers. This guide covers every operation, credential setup, common gotchas, and three production-ready patterns.


What ActiveMQ Is (and When to Use the n8n Node)

Apache ActiveMQ is an open-source message broker that implements the JMS (Java Message Service) standard. It supports multiple wire protocols; n8n connects via STOMP (Simple Text Orientated Messaging Protocol), which ActiveMQ exposes on port 61613 by default.

Use the ActiveMQ node when you need to:

  • Integrate n8n with a Java/.NET enterprise system that already publishes to ActiveMQ
  • Decouple workflow triggers from the systems that generate events
  • Implement async job queues, order processing pipelines, or event-driven notifications
  • Bridge ActiveMQ messages to modern cloud services (Slack, Stripe, databases)

Credential Setup

In n8n, go to Credentials → New → ActiveMQ.

Field Value
Host Your ActiveMQ broker hostname or IP
Port 61613 (STOMP default)
Username ActiveMQ user (default: admin)
Password ActiveMQ password (default: admin)
SSL Enable if your broker requires TLS

Default credentials: Out-of-the-box ActiveMQ ships with admin/admin. Change these before exposing your broker to any network.

To verify the broker is reachable: telnet <host> 61613 — you should get a STOMP banner.


Operations

Send Message

Publishes a message to an ActiveMQ queue or topic.

Parameter Description
Destination Type Queue or Topic
Destination Name e.g., orders.processing or /topic/alerts
Message The message body — plain text or JSON string
Headers Optional STOMP headers as key-value pairs

Queue vs Topic:

  • Queue — point-to-point; each message is consumed by exactly one consumer. Use for job queues, order processing.
  • Topic — publish-subscribe; all subscribers receive a copy. Use for broadcast events, notifications.
Destination Type: Queue
Destination Name: orders.new
Message: {{ JSON.stringify($json) }}
Enter fullscreen mode Exit fullscreen mode

ActiveMQ Trigger (Consume)

The ActiveMQ Trigger node subscribes to a queue or topic and fires the workflow each time a message arrives.

Parameter Description
Destination Type Queue or Topic
Destination Name Queue/topic to subscribe to
Options → Durable For topics: persist subscription across broker restarts

Output: the trigger node outputs json.message (the message body) and json.headers (STOMP headers).


Common Gotchas

Gotcha Fix
Port 61613 not reachable ActiveMQ disables STOMP by default in some versions — enable it in activemq.xml under <transportConnectors>
Authentication failure Check conf/credentials.properties or jaas-guest.conf — default admin/admin may have been changed
Messages not consumed Verify the destination name matches exactly (case-sensitive); queue names do not include /queue/ prefix by default in STOMP
Topic messages missed on restart Use durable subscriptions and set a client-id in headers so the broker can replay buffered messages
Large message payloads ActiveMQ has a default max message size — increase maxMessageSize in broker config or chunk payloads
n8n trigger not firing In n8n Cloud or Docker, ensure the broker is network-accessible from the n8n container; check firewall/security group rules
SSL certificate errors If using self-signed certs, import the CA into the JVM truststore on the broker side; on the n8n side, toggling SSL on and providing the correct host usually suffices

Three Production Patterns

Pattern 1: Order Processing Queue

E-commerce system publishes order events → n8n consumes → validates → updates CRM + sends confirmation email.

ActiveMQ Trigger (queue: orders.new)
  → Code node: parse + validate order JSON
  → IF: order.total > 1000 → Slack alert (high-value order)
  → HTTP Request: POST to CRM /orders
  → Send Email (Resend): order confirmation to customer
  → ActiveMQ Send: publish to queue orders.fulfilled
Enter fullscreen mode Exit fullscreen mode

Why ActiveMQ here: The e-commerce platform already publishes to ActiveMQ; this avoids changing the upstream system while letting n8n handle all downstream orchestration.

Pattern 2: Dead Letter Queue (DLQ) Monitor

ActiveMQ automatically routes failed messages to ActiveMQ.DLQ. Monitor it to alert on processing failures.

ActiveMQ Trigger (queue: ActiveMQ.DLQ)
  → Code node: extract original destination + error headers
  → Slack: "Message processing failed on {{ $json.headers['original-destination'] }}"
  → Google Sheets: log failed message for manual review
  → ActiveMQ Send: optionally re-route to a retry queue after N minutes (use Wait node)
Enter fullscreen mode Exit fullscreen mode

Key header: original-destination tells you which queue the message came from before it was dead-lettered.

Pattern 3: Topic Fan-Out to Multiple Services

Upstream system publishes an inventory.updated event → n8n subscribes and fans out to multiple downstream services.

ActiveMQ Trigger (topic: inventory.updated)
  → Split In Batches: process each SKU update
  → Branch A: HTTP Request → update Shopify inventory
  → Branch B: HTTP Request → update warehouse WMS API  
  → Branch C: IF stock < reorder_point → Slack alert + create PO draft
Enter fullscreen mode Exit fullscreen mode

Free Workflow JSON (importable):

{
  "name": "op: ActiveMQ Order Processor",
  "nodes": [
    {
      "parameters": {
        "destinationType": "queue",
        "destination": "orders.new",
        "options": {}
      },
      "name": "ActiveMQ Trigger",
      "type": "n8n-nodes-base.activeMqTrigger",
      "typeVersion": 1,
      "position": [240, 300],
      "id": "a1b2c3d4-0001-0001-0001-000000000001"
    },
    {
      "parameters": {
        "jsCode": "const msg = JSON.parse($json.message || '{}');\nreturn [{ json: { ...msg, processedAt: new Date().toISOString() } }];"
      },
      "name": "Parse Order",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [460, 300],
      "id": "a1b2c3d4-0001-0001-0001-000000000002"
    },
    {
      "parameters": {
        "conditions": {
          "number": [{ "value1": "={{ $json.total }}", "operation": "largerEqual", "value2": 1000 }]
        }
      },
      "name": "High Value?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [680, 300],
      "id": "a1b2c3d4-0001-0001-0001-000000000003"
    },
    {
      "parameters": {
        "channel": "#orders",
        "text": "=High-value order received: ${{ $json.total }} from {{ $json.customer }}"
      },
      "name": "Slack Alert",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.2,
      "position": [900, 200],
      "id": "a1b2c3d4-0001-0001-0001-000000000004"
    }
  ],
  "connections": {
    "ActiveMQ Trigger": { "main": [[{ "node": "Parse Order", "type": "main", "index": 0 }]] },
    "Parse Order": { "main": [[{ "node": "High Value?", "type": "main", "index": 0 }]] },
    "High Value?": { "main": [[{ "node": "Slack Alert", "type": "main", "index": 0 }], []] }
  }
}
Enter fullscreen mode Exit fullscreen mode

Key Takeaways

  • n8n connects to ActiveMQ via STOMP on port 61613 — confirm this transport connector is enabled in your broker config
  • Queue = one consumer per message (job queues); Topic = all subscribers receive a copy (events/broadcasts)
  • Use durable subscriptions on topics if your workflow might restart and you can't miss messages
  • The ActiveMQ.DLQ is your friend — always monitor it to catch silent processing failures
  • For enterprise environments: match the destination name exactly, check credentials in credentials.properties, and verify network routing from the n8n host to the broker

Want a complete n8n automation toolkit? The n8n Workflow Starter Pack ($29) includes 10 production-ready workflow JSONs for the most common automation patterns — lead capture, Stripe fulfillment, error monitoring, and more. Import and run in minutes.

Top comments (1)

Collapse
 
pirateprentice profile image
Pirate Prentice

Are you using ActiveMQ with n8n in production? Curious whether folks are hitting STOMP over plain TCP or TLS — and whether you're using queues, topics, or both. Drop your setup in the comments!