Skip to main content

What are Routes?

Routes define connections between your Coreflux MQTT broker and external systems. They enable broker-to-broker communication, database storage, industrial protocol integration, REST API connectivity, email notifications, AI integration, and media processing - all without writing custom middleware.
Routes extend your broker’s capabilities by creating managed connections to external systems - all configured through LoT syntax.

Route Categories

This page covers the fundamentals of route configuration. Choose a specific route category above for detailed syntax and examples.

Basic Syntax

DEFINE ROUTE <route_name> WITH TYPE <route_type>
    ADD <CONFIG_SECTION>
        WITH <parameter> "<value>"
    ADD MAPPING <mapping_name>
        WITH SOURCE_TOPIC "<source>"
        WITH DESTINATION_TOPIC "<destination>"

Components

route_name
string
required
Unique identifier for the route. Use descriptive names like CloudBridge, SensorDataIndexer, AlertEmailer.
route_type
type
required
The type of route (see Available Route Types below).
CONFIG_SECTION
block
Configuration blocks specific to the route type (e.g., MQTT_CONFIG, MONGODB_CONFIG, REST_API_CONFIG).
MAPPING
block
Defines topic mappings for data flow between source and destination.

Available Route Types

Route TypeDescription
MQTT_CLUSTERBroker clustering and scalability

Quick Examples

Send email notifications from MQTT events:
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"
        WITH USE_TLS "true"
    ADD EVENT criticalAlert
        WITH SOURCE_TOPIC "alerts/critical/+"
        WITH SUBJECT "Critical Alert: {value.json.type}"
        WITH RECIPIENT "[email protected]"

Common Configuration Patterns

MQTT Configuration

Most routes include an MQTT configuration section. Use the shorthand for the local broker:
ADD MQTT_CONFIG
    WITH BROKER SELF
Or specify connection details explicitly:
ADD MQTT_CONFIG
    WITH BROKER_ADDRESS "127.0.0.1"
    WITH BROKER_PORT '1883'
    WITH CLIENT_ID "MyRouteClient"
    WITH USERNAME "user"
    WITH PASSWORD "password"

Topic Mappings

Define how topics map between source and destination. Wildcards are supported in topic patterns:
ADD MAPPING <mapping_name>
    WITH SOURCE_TOPIC "sensors/+/temperature"
    WITH DESTINATION_TOPIC "processed/+/temperature"
    WITH DIRECTION "<out|in|both>"
Direction Options:
  • out - Source to destination only
  • in - Destination to source only
  • both - Bidirectional sync

Use Cases

Bridge local edge data to cloud brokers:
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 USE_TLS "true"
    ADD MAPPING allSensors
        WITH SOURCE_TOPIC "local/sensors/#"
        WITH DESTINATION_TOPIC "edge-01/sensors/#"
        WITH DIRECTION "out"

Next Steps