Streaming analytics with Apama EPL

Using the Streaming Analytics application, you can add your own logic to your IoT solution for immediate processing of incoming data from devices or other data sources. These user-defined operations can, for example, alert applications of new incoming data, create new operations based on the received data (such as sending an alarm when a threshold for a sensor is exceeded), or trigger operations on devices.

The operation logic is based on Apama’s Event Processing Language (Apama EPL).

Typical real-time analytics use cases include:

The following sections describe how you can create your own analytics or other server-side business logic and automation. You can do this using analytic models, EPL apps, and smart rules.

This documentation assumes basic familiarity with Apama application development. Refer to the Apama documentation for further details.

Home screen

You access the Streaming Analytics application using the application switcher.

Streaming Analytics home screen

The home screen of the Streaming Analytics application lets you navigate to the different pages of the application. These are Analytics Builder and EPL Apps. You can access these pages using the corresponding Open button on the home screen or by using the navigator on the left.

If you need more space for a page, you can hide the navigator. Click the small arrow at the very left of the top bar to toggle the display of the navigator.

The home screen also provides information on smart rules. You create and maintain them with the Cockpit application. See Cockpit > Smart rules in the User guide for detailed information.

The home screen and navigator only show entries for the items that you are allowed to use, depending on the version of the Apama-ctrl microservice to which your tenant is subscribed. See also Microservice runtime and applications and Customizing the home screen of the Streaming Analytics application.

Analytics Builder

The Analytics Builder page of the Streaming Analytics application allows you to build analytic models that transform or analyze streaming data in order to generate new data or output events. The models are capable of processing data in real time.

You build the models in a graphical environment by combining pre-built blocks into models. The blocks in a model package up small bits of logic, and have a number of inputs, outputs and parameters. Each block implements a specific piece of functionality, such as receiving data from a sensor, performing a calculation, detecting a condition, or generating an output signal. You define the configuration of the blocks and connect the blocks using wires. You can edit the models, simulate deployment with historic data, or run them against live systems.

See the documentation for Analytics Builder for detailed information.

EPL Apps

The EPL Apps page of the Streaming Analytics application allows you to develop EPL apps (that is, single *.mon files) directly within Cumulocity IoT, written in Apama EPL. You can also import existing *.mon files as EPL apps into Cumulocity IoT. When you activate an EPL app from the Streaming Analytics application, you deploy it to Cumulocity IoT.

A quick way to get started is to explore the code of the EPL samples that can be accessed from the EPL editor. See Developing apps with the Streaming Analytics application for information on how to create an EPL app and access the samples. For a start, use one of the simpler samples with temperature measurements, such as “Create an alarm if a measurement exceeds a threshold value”. You can immediately see results using this sample. Add your own EPL code to the sample and try out your changes.

You use the Apama API for interacting with Cumulocity IoT. For detailed information, see the com.apama.cumulocity package in the API Reference for EPL (ApamaDoc), which is part of the Apama documentation.

Microservice runtime and applications

Analytic models, EPL apps and smart rules are executed in an Apama-ctrl microservice. This has a per-tenant isolation scope, that is, each subscribed tenant has its own instance of an Apama container with dedicated resources (that is, memory and CPU usage). The container is isolated from other tenants, hence high CPU load or memory issues on other containers are tracked and resourced independently.

To do this you need the following
Build analytic models Apama-ctrl microservice and Streaming Analytics application
Develop EPL apps Apama-ctrl microservice and Streaming Analytics application
Use smart rules Apama-ctrl microservice and Smartrule microservice (included in Cumulocity IoT’s Standard tenant)

See also the following sections in the User guide:

If your tenant is subscribed to the Apama-ctrl-starter microservice, then the following applies:

If your tenant is subscribed to the Apama-ctrl-smartrules or Apama-ctrl-smartrulesmt microservice, the Analytics Builder and EPL Apps pages are not available in the Streaming Analytics application.

Contact product support to discuss adding more capabilities.