apama-analytics-builder-block-sdk

Building a block into an extension

Once a block is written in EPL, it can be packaged into an “extension”. Extensions are .zip files that can be used to add blocks to the Analytics Builder runtime. Analytics Builder is deployed within Cumulocity IoT, and extensions are stored in the inventory. The extensions are only read when the Apama-ctrl microservice inside Cumulocity IoT is started, so the service must be restarted to make use of a new block. Restarting the microservice will lose state in any running models or custom EPL applications running in that tenant. This SDK provides a command line utility called analytics_builder which is available in the root directory of the SDK. This can be used to build an extension or list an extension or manage an extension in a Cumulocity IoT installation. You must navigate out of the model editor to the model manager and back to the editor to expose the new blocks after uploading an extension.

Most of the analytics_builder commands use an --input argument that specifies the path to a directory. All files in that directory are included in the .zip file, except for the files with the following extensions: .log, .classpath, .dependencies, .project, .deploy, .launch, .out, and .o. Files in the .git and .github subdirectories are also not included. The message files named messages.json or matching *-messages.json are used for the runtime messages.

The analytics_builder script is run from an Apama command prompt (on Windows, run Apama Command Prompt from the Start Menu group of your Apama installation; on Linux, source the apama_env script). Note: You must place the script in a directory that does not have any spaces in its full path.

The analytics_builder script takes a two-word command, followed by any arguments required by the command. Available commands are:

Build and upload an extension to a Cumulocity IoT instance. For example:

  analytics_builder build extension --input samples/blocks --cumulocity_url https://demo.cumulocity.com/ --username tenantID/user --password pass

See the analytics_builder --help output for full details of the options.

Common options

For build extension and upload extension:

Note: If you wish to use the samples provided in the samples directory as the starting point for your own blocks, it is strongly recommended that you:

This avoids any confusion as to the functionality and ownership of the blocks. The samples are not productized blocks, and are subject to removal or changes in future releases without notice.

Invalid or corrupt extensions

If the uploaded extension is invalid, corrupt, or duplicate, it is not injected into the correlator and warning or error messages are logged in the microservice logs. Here is a list of the warning or error messages that are generated and how to resolve the problem: