Data pipeline routes enable data flow between your Coreflux broker and external systems. They connect your broker to other MQTT brokers and email services.
Like a postal forwarding service. Mail (messages) sent to your old address (local broker) automatically gets forwarded to your new address (remote broker). You set up the forwarding rules once, and it just works.
The pipeline route types are:
MQTT Bridge - Broker-to-broker communication for edge-to-cloud sync and multi-site connectivity
Email - Send notifications and alerts triggered by MQTT messages
The MQTT_BRIDGE route enables seamless data transfer between two MQTT brokers. Use it for edge-to-cloud synchronization, multi-site connectivity, or backup systems.
DEFINE ROUTE CloudBridge WITH TYPE MQTT_BRIDGE ADD SOURCE_CONFIG WITH BROKER SELF ADD DESTINATION_CONFIG WITH BROKER_ADDRESS "cloud.example.com" WITH BROKER_PORT '8883' WITH CLIENT_ID "EdgeDevice001" WITH USE_TLS "true" ADD MAPPING sensorSync WITH SOURCE_TOPIC "sensors/+/data" WITH DESTINATION_TOPIC "edge/sensors/+/data" WITH DIRECTION "out"
DEFINE ROUTE EdgeToCloud WITH TYPE MQTT_BRIDGE ADD SOURCE_CONFIG WITH BROKER SELF ADD DESTINATION_CONFIG WITH BROKER_ADDRESS "iot.cloud-provider.com" WITH BROKER_PORT '8883' WITH CLIENT_ID "EdgeDevice001" WITH USERNAME "edge_user" WITH PASSWORD "secure_password" WITH USE_TLS "true" ADD MAPPING sensorData WITH SOURCE_TOPIC "sensors/+/data" WITH DESTINATION_TOPIC "edge-001/sensors/+/data" WITH DIRECTION "out"
Receive commands from cloud to local broker:
Copy
Ask AI
DEFINE ROUTE CloudCommands WITH TYPE MQTT_BRIDGE ADD SOURCE_CONFIG WITH BROKER SELF ADD DESTINATION_CONFIG WITH BROKER_ADDRESS "iot.cloud-provider.com" WITH BROKER_PORT '8883' WITH CLIENT_ID "EdgeDevice001-Commands" WITH USE_TLS "true" ADD MAPPING commands WITH SOURCE_TOPIC "local/commands/#" WITH DESTINATION_TOPIC "edge-001/commands/#" WITH DIRECTION "in"
Full two-way synchronization:
Copy
Ask AI
DEFINE ROUTE FullSync WITH TYPE MQTT_BRIDGE ADD SOURCE_CONFIG WITH BROKER SELF ADD DESTINATION_CONFIG WITH BROKER_ADDRESS "partner-broker.example.com" WITH BROKER_PORT '1883' WITH CLIENT_ID "SyncClient" ADD MAPPING bidirectionalSync WITH SOURCE_TOPIC "shared/data/#" WITH DESTINATION_TOPIC "partner/data/#" WITH DIRECTION "both"
TLS-encrypted bridge with mutual authentication:
Copy
Ask AI
DEFINE ROUTE SecureBridge WITH TYPE MQTT_BRIDGE ADD SOURCE_CONFIG WITH BROKER_ADDRESS "192.168.1.10" WITH BROKER_PORT '8883' WITH CLIENT_ID "SecureSource" WITH USE_TLS "true" WITH SERVER_CA_CERT_PATH "/certs/ca.pem" WITH CLIENT_CERT_PATH "/certs/client.pem" WITH CLIENT_CERT_PASS "cert_password" ADD DESTINATION_CONFIG WITH BROKER_ADDRESS "secure.cloud.com" WITH BROKER_PORT '8883' WITH CLIENT_ID "SecureDest" WITH USE_TLS "true" WITH ALLOW_UNTRUSTED_CERTS "false" ADD MAPPING secureMapping WITH SOURCE_TOPIC "secure/+/data" WITH DESTINATION_TOPIC "cloud/+/data" WITH DIRECTION "out"
DEFINE ROUTE AlertEmail WITH TYPE EMAIL ADD SMTP_CONFIG WITH HOST "smtp.gmail.com" WITH PORT '587' WITH USERNAME "[email protected]" WITH PASSWORD "app-password-here" WITH USE_TLS "true" ADD EVENT criticalAlert WITH SOURCE_TOPIC "alerts/critical/+" WITH SUBJECT "CRITICAL: {value.json.alert_type}" WITH RECIPIENT "[email protected]"
DEFINE ROUTE CriticalAlerts WITH TYPE EMAIL ADD SMTP_CONFIG WITH HOST "smtp.gmail.com" WITH PORT '587' WITH USERNAME "[email protected]" WITH PASSWORD "app-password-here" WITH USE_TLS "true" ADD EVENT criticalNotify WITH SOURCE_TOPIC "alerts/critical/+" WITH TEMPLATE_PATH "/templates/critical_alert.html" WITH SUBJECT "CRITICAL: {value.json.alert_type}" WITH RECIPIENT "[email protected]"
Send to email address from payload:
Copy
Ask AI
DEFINE ROUTE UserNotifications WITH TYPE EMAIL ADD SMTP_CONFIG WITH HOST "smtp.office365.com" WITH PORT '587' WITH USERNAME "[email protected]" WITH PASSWORD "secure-password" WITH USE_TLS "true" ADD EVENT userNotify WITH SOURCE_TOPIC "users/+/notifications" WITH TEMPLATE_PATH "/templates/user_notification.html" WITH SUBJECT "Hello {value.json.username}" WITH RECIPIENT "{value.json.email}"
Include images in email:
Copy
Ask AI
DEFINE ROUTE ReportEmail WITH TYPE EMAIL ADD SMTP_CONFIG WITH HOST "smtp.company.com" WITH PORT '587' WITH USERNAME "[email protected]" WITH PASSWORD "password" WITH USE_TLS "true" ADD EVENT sendReport WITH SOURCE_TOPIC "reports/daily" WITH TEMPLATE_PATH "/templates/daily_report.html" WITH SUBJECT "Daily Report - {value.json.date}" WITH RECIPIENT "[email protected]" WITH EMBED_RESOURCES ADD "/images/logo.png" ADD "/images/chart.png"
For Gmail, use an App Password instead of your regular password. Enable 2FA on your Google account first.