Build Flows
In this guide we will start by creating a basic example Flow. It doesn't connect to any external system, the goal is just to get you familiarized with the concept of building and testing Flows.
We will use an internal data source, aggregate some values and send the result to the internal MQTT broker. In the next example we will connect to external systems and introduce more of the features offered by the Crosser solution.
The Flow - How it works
A Flow consists of modules that are connected together to specify the sequence of operations to apply to your data. Data is represented by messages and each module will process messages as soon as they arrive, perform some action and typically produce a new or modified message on its output, which is then processed by the next module(s).
A Flow starts with one or several input modules. These can be internal sources, like time triggers or data generators, but also connectors to external systems, such as APIs, databases and PLCs. Next you will have one or several modules to do something with the input messages. Finally you deliver the results to an output module, where the messages leave the Flow.
A Flow operates like a pipeline, so multiple messages can be processed simultaneously in different modules. Each module needs to be configured for a specific use case. For input and output modules the main thing is to configure how to connect to the external systems.
Module Settings
For analytics modules that receive and process messages, there are two main categories of settings:
- Which data to use? Messages are typically structured objects with properties and values, so you need to tell the module which data to use as input and where to store the result in the output message. If you want to get a better understanding of messages and properties and how they relate to module settings a good starting point is the first session in the Fundamentals training course.
- Data Processing - The second type of settings for analytics modules controls how the actual processing will be done on the selected data. For example, which mathematical expression to apply or setting limits in a range filter. For an overview of the analytics module, see this page
Flows are created and managed in the Flow Studio. You access the Flow Studio using the button in the upper left corner of each page. Once you've built a Flow you can also open it in the editor from the Flows page. For an introduction to the Flow Studio, see here →
Follow these steps to start creating your first Flow:
- Open the Flow Studio using the "Flow Studio" button to the left in the top menu. You should now see an empty Flow.
- The starting point is the library of pre-built modules, available on the left side of the drawing canvas by clicking on the button in the menu bar. There are three categories of modules: Input modules - Gets data from internal or external sources, such as time triggers, APIs and PLCs. Analytics modules - Process the data in some way, or specify conditional triggers based on the data. Output modules - Delivers processed data or triggers to external systems.
- We will start by adding an internal data source to our Flow. Find the Data Generator module in the list and drag and drop in the main Flow page (you can use search to find a specific module). This module can be used to generate different types of test data.
- To change module setting, hover over the module with the mouse and click on the cogwheel () button to open the settings panel. The settings panel has three tabs: Settings - Module specific settings. Common - Settings that are available on all modules. We leave them for now. Documentation - Documentation on the module and its settings.
- Now you need to add the relevant settings for the Data Generator. Scroll down to the JSON input field and click on "Add example". All other settings you can leave as they are for now.
- Now we will add the rest of the needed modules.:
- First locate the Aggregate module in the Analytics modules list and drag and drop into the Flow.
- Connect the Data Generator module with the Aggregate module by dragging the connection from the Data Generator module to the Aggregate module.
- Now locate the MQTT Pub Broker module in the Output module list and drag and drop it to the right of the Aggregate module.
- Then connect the Aggregate module with the MQTT Pub Broker module.
The Flow should now look like below:
- Module settings:
- Now we need to add the relevant settings for the Aggregate module.
- Open the settings panel and make the following changes:
- Source Property - Should be name
- Value Property - Should be data.temp
- Target Property - Should be aggregate
- Mode - Should be set to
- Count Count - Should be set to 5 For the MQTT Pub Broker module, set Topic to foo/bar and Source Property to aggregate.
- Note how the property settings determine how each module uses message data.
- Open the settings panel and make the following changes:
- Now we need to add the relevant settings for the Aggregate module.
- Now it is time to save your Flow. Click Save in the lower right corner to save the Flow. You will now be asked to provide a name for the Flow and a short description that describes what the Flow does.
- Click Create to store your new Flow.
Next step is to test your Flow, see the introduction here →
Page Sections