8. Integrate FogFlow with FIWARE

Since November 2017 FogFlow has been promoted as an incubated open source Generic Enabler (GE) in the FIWARE community. Within this community, FogFlow holds a unique position as Cloud-Edge Orchestrator to launch and manage dynamic data processing flows seamlessly over cloud and edges for data ingestion, transformation, and also advanced analytics.

As illustrated by the following picture, FogFlow can interwork with other FIWARE GEs to power FIWARE-based IoT Platforms at the following two layers. At the upper layer, FogFlow can interwork with Orion Broker via the standardized NGSI interface in the following two ways.

8.1. Orion Broker as the Destination

The first way is to consider Orion Broker as the destination of any context information generated by a FogFlow IoT service. In this case a NGSI subscription must be issued by an external application or FogFlow Dashboard to ask FogFlow to forward the requested context updates to a specified Orion Broker.


Two ways are provided to tell FogFlow which entitie should be forwarded to the Orion Broker. The first way is to issue a raw subscription to FogFlow Broker. The second way is to write a small JavaScript program to do this. Examples are provided below. Notice that the integration is using the NGSI V2 interface of Orion Broker.


  • fogflowBroker: IP address of the FogFlow Broker, it could be “webportal_ip” or “coreservice_ip” in the configuration file. This is up to where you access the FogFlow system.
  • orionBroker: the accessible IP address of your Orion Running Instance.
curl -iX POST \
  'http://fogflowBroker:8080/ngsi10/subscribeContext' \
  -H 'Content-Type: application/json' \
  -H 'Destination: orion-broker' \
  -d '{"entities": [{"type": "PowerPanel", "isPattern": true}],
                            "reference": "http://orionBroker:1026/v2"} '
// please refer to the JavaScript library, located at  https://github.com/smartfog/fogflow/tree/master/designer/public/lib/ngsi

//  entityType: the type of context entities to be pushed to Orion Broker
//  orionBroker: the URL of your running Orion Broker
function subscribeFogFlow(entityType, orionBroker)
    var subscribeCtxReq = {};
    subscribeCtxReq.entities = [{type: entityType, isPattern: true}];
    subscribeCtxReq.reference =  'http://' + orionBroker + '/v2';

    client.subscribeContext4Orion(subscribeCtxReq).then( function(subscriptionId) {
    }).catch(function(error) {
        console.log('failed to subscribe context');

// client to interact with IoT Broker
var client = new NGSI10Client(config.brokerURL);

subscribeFogFlow('PowerPanel', 'cpaasio-fogflow.inf.um.es:1026');

To verify if the requested data has been pushed to your Orion Broker, you can send the following NGSI v2 query to check it.

curl http://orionBroker:1026/v2/entities?type=PowerPanel -s -S -H 'Accept: application/json'

8.2. Orion Broker as a Data Source

The second way is to consider Orion Broker as a data source to provide additional information. In this case we can implement a simple fog function to fetch any necessary information into the FogFlow system. In either way there is no need to make any change to the existing Orion-based FIWARE system. Therefore, this type of integration can be done fast with nearly zero effort. At the low layer, for the integration with any Non-NGSI supported devices like MQTT, COAP, OneM2M, OPC-UA, LoRaWAN, FogFlow can reuse the modules of existing IoT agents and transform them into FogFlow adapters based on the fog function programming model. With these adapters FogFlow can dynamically launch necessary adapters for device integration directly at edges. This way FogFlow is able to talk with a wide range of IoT devices.

Currently, the MQTT based adapter has been provided and it is also open source in a seperated repository. Please refer to https://github.com/smartfog/adapter

In the future, we consider to provide an adapter to IoT-agents. As illustrated by the following figure, this adapter could be reused to integrate with all types of FIWARE IoT agents.