Streaming Web flow fragment examples

Directory structure

The recommended Streaming Web directory structure is :

EventFlow directory structure

Note that the default source directory is set by the plugin to src/main/eventflow.

The following pom.xml will build and install to the local maven repository, a Streaming Web fragment.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <!-- vim: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab : -->

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.tibco.ep</groupId>
    <artifactId>swfrag</artifactId>
    <packaging>ep-sw-fragment</packaging>
    <version>1.0.0</version>
    <name>hello world</name>

    <!-- common definitions for this version of StreamBase -->
    <parent>
        <groupId>com.tibco.ep.sb.parent</groupId>
        <artifactId>ep-sw-fragment</artifactId>
        <version>${sbrtVersion}</version>
    </parent>

</project>

When the maven install goal is called (mvn install), this pom.xml instructs maven to perform the following steps :

  1. Uses install-product to check if the dependent product ( in this case com.tibco.ep.thirdparty:tibco-sb_linuxx86_64 ) is installed. If its not, maven will download the archive and the plugin will extract into $TIBCO_EP_HOME.

  2. Uses package-sw-fragment to create a Streaming Web flow fragment zip file in the build directory (by default, set to target) and attaches it to the build.

  3. Uses the standard maven plugin maven-install-plugin:install to install the built and tested artifacts to the local maven repository.

An example run is shown below :

$ mvn install
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Streaming Web Flow Fragment - GoldyLocks 3.0.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- ep-maven-plugin:1.0.0:install-product (default-install-product-1) @ goldylocks ---
[INFO] com.tibco.ep.thirdparty:tibco-sb_osxx86_64:zip:7.6.0:test already installed
[INFO] 
[INFO] --- ep-maven-plugin:1.3.1-SNAPSHOT:package-sw-fragment (default-package-sw-fragment) @ sw ---
[INFO] Building zip: /Users/me/examples/sw/target/sw-10.5.0-SNAPSHOT-ep-sw-fragment.zip
[INFO] 
[INFO] >>> maven-source-plugin:3.0.1:jar (attach-sources) > generate-sources @ sw >>>
[INFO] 
[INFO] --- ep-maven-plugin:1.3.1-SNAPSHOT:install-product (default-install-product-1) @ sw ---
[INFO] com.tibco.ep.sb.rt:platform_osxx86_64:zip:10.5.0-SNAPSHOT:test already installed manually to /Users/me/work/sb10dist
[INFO] 
[INFO] --- buildnumber-maven-plugin:1.4:create-timestamp (default) @ goldylocks ---
[INFO] 
[INFO] --- maven-source-plugin:3.0.1:jar (attach-sources) @ sw ---
[INFO] 
[INFO] --- maven-javadoc-plugin:3.0.1:jar (attach-javadocs) @ sw ---
[INFO] 
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ sw ---
[INFO] Installing /Users/me/examples/sw/target/sw-10.5.0-SNAPSHOT-ep-sw-fragment.zip to /Users/me/workspace/BUILD/repository/com/tibco/example/sw/10.5.0-SNAPSHOT/sw-10.5.0-SNAPSHOT.zip
[INFO] Installing /Users/me/examples/sw/pom.xml to /Users/me/workspace/BUILD/repository/com/tibco/example/sw/10.5.0-SNAPSHOT/sw-10.5.0-SNAPSHOT.pom
[INFO] Installing /Users/me/examples/sw/target/sw-10.5.0-SNAPSHOT-sources.jar to /Users/me/workspace/BUILD/repository/com/tibco/example/sw/10.5.0-SNAPSHOT/sw-10.5.0-SNAPSHOT-sources.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.410 s
[INFO] Finished at: 2016-02-01T14:20:02+00:00
[INFO] Final Memory: 38M/580M
[INFO] ------------------------------------------------------------------------

A Streaming Web project needs to express dependencies on the block projects referenced from the project's flow diagram. These projects' fragments will be added to the fragment.

For example :

...
    <dependencies>

        <!-- compile, test and deploy dependencies -->
        <dependency>
            <groupId>com.tibco.example</groupId>
            <artifactId>myBlock</artifactId>
            <type>ep-eventflow-fragment</type>
            <version>1.0.0</version>
        </dependency>

        ...

    </dependencies>