Skip to content

Add automated EMQX bridge setup for Expert broker#7184

Open
Steve-Mcl wants to merge 11 commits intomainfrom
feat-expert-bridged
Open

Add automated EMQX bridge setup for Expert broker#7184
Steve-Mcl wants to merge 11 commits intomainfrom
feat-expert-bridged

Conversation

@Steve-Mcl
Copy link
Copy Markdown
Contributor

@Steve-Mcl Steve-Mcl commented May 3, 2026

Description

TLDR
Adds setup and maintenance for automated configuration of FF App team broker to new central Expert Broker

DETAILS
This PR introduces provisioning for the EMQX bridge between the FlowFuse App Instance Broker and the Expert Broker. It adds resource templates, orchestrator and helper functions, and scheduled tasks to ensure the bridge is always correctly configured and synchronized, both at startup and on a weekly basis. Additionally, it extends the license API to expose the raw license string (for configuring the bridge), and adds corresponding unit tests.

EMQX Bridge Provisioning and Management

  • Added a new module setup.js that provides high-level orchestration (syncBridge), low-level resource management (addBridge, removeBridge), and health-check (validateBridge) functions for the EMQX bridge, including dependency-aware resource creation and teardown, configuration validation, and error handling.
  • Defined resource templates for the EMQX connector, actions, sources, and rules in templates.js, supporting the full bridge lifecycle and MQTT v5 features required for expert chat and inflight requests.

Automated Bridge Synchronization

  • Registered a startup task to perform a full bridge resynchronization at application startup, ensuring any changes to templates or license details are applied immediately.
  • Added a weekly scheduled task that checks and repairs the bridge if any resources are missing or if license details have changed, minimizing disruption to active sessions.

License API

  • Updated the license API to expose a raw() method, returning the raw license string for use in bridge configuration.
  • Added unit tests to verify the new raw() method and license status reporting in both licensed and unlicensed scenarios. [1] [2]

Related Issue(s)

closes #7181

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production
  • Link to Changelog Entry PR, or note why one is not needed.

Labels

  • Includes a DB migration? -> add the area:migration label

@codecov
Copy link
Copy Markdown

codecov Bot commented May 3, 2026

Codecov Report

❌ Patch coverage is 93.86503% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.72%. Comparing base (c3c8f6f) to head (5982f02).

Files with missing lines Patch % Lines
forge/ee/lib/expert/tasks/startup.js 0.00% 4 Missing ⚠️
forge/ee/lib/expert/tasks/weekly.js 0.00% 4 Missing ⚠️
forge/ee/lib/expert/emxq-bridge/setup.js 98.63% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7184      +/-   ##
==========================================
+ Coverage   76.59%   76.72%   +0.13%     
==========================================
  Files         405      409       +4     
  Lines       20579    20742     +163     
  Branches     4975     5016      +41     
==========================================
+ Hits        15762    15915     +153     
- Misses       4817     4827      +10     
Flag Coverage Δ
backend 76.72% <93.86%> (+0.13%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@hardillb hardillb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to sort out the TLS stuff, give me a shout if needed.

And just a schedule bit

Comment thread forge/ee/lib/expert/emxq-bridge/setup.js
Comment thread forge/ee/lib/expert/tasks/startup.js Outdated
Co-authored-by: Ben Hardill <ben@flowforge.com>
@Steve-Mcl Steve-Mcl requested a review from hardillb May 6, 2026 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automated EMQX Bridge Setup for Expert over pubsub

2 participants