Packaging Carbon Applications

Disclaimer !!!

#### Disclaimer I prepare this post based on one of my internship projects.

I initially follow the instructions provided in the documentation and online sources to packaging artifacts as carbon applications. But the documents are not completed enough. In this article, I describe how I achieve the goal.

Carbon Applications - CApp

CApp defines the composite apps containing several artifacts related to both real-time and batch analytics.

It includes the following artifacts

  1. Event Receivers
  2. Event Streams
  3. Event Publisher
  4. Execution Plans
  5. Event Store
  6. Spark scripts
  7. Gadget
  8. Layout
  9. Dashboard
  10. Data Purging * - Use to purge the data from data store made by event store

We can build the CApp using the pom.xml file. After building, the CApp will be built in .car format in the target folder. Then we can deploy .car file as the Carbon Application at the management console level. This process will eventually deploy all the artifacts in the CApp

Sample build.xml, and pom.xml files,

<?xml version="1.0" encoding="UTF-8"?>
<project name="create-sample-CApps" default="zip" basedir=".">
<property name="project-name" value="${}"/>
<property name="target-dir" value="target"/>
<property name="CApp_sample_dir" value="sample"/>
<target name="clean">
<delete dir="${target-dir}"/>
<target name="pre-configure">
<mkdir dir="${target-dir}"/>
<copy file="README.txt" todir="${target-dir}"/>
<target name="zip" depends="clean,pre-configure">
<zip destfile="${target-dir}/${sample}.car">
<zipfileset dir="${sample}"/>

We can add over own property name and value based on our use-cases, CApp models. And in the zip field of xml file, we provide the location to store the zip file.

<?xml version="1.0" encoding="utf-8"?>
<project xmlns:xsi="" xmlns=""
<name>WSO2 Data Analytics Server - Sample Composite Applications</name>
<ant antfile="build.xml" target="zip"/>

This the pom.xml file for all CApps, you need to build this to get any CApps you want(the CApps you preferred at the build.xml file)


To include jaggery-apis with CApps, we can implement a jaggery controller at the gadget level rather than the jaggery app level. Eventually, that will helps in deploying apps.