Structuring Streaming and LiveView combined projects

Structuring Streaming and LiveView combined projects

book

Article ID: KB0079494

calendar_today

Updated On:

Products Versions
TIBCO Streaming -

Description

I have a LiveView project with StreamBase Interface files (*.sbint) containing Table schemas for use in data-sources and publishers, and a StreamBase project which uses them. In TIBCO Streaming version 10 using Maven, how should these be related?

What are the ways to create StreamBase (SB) and LiveView (LV) projects that share dependencies in Studio?

Issue/Introduction

Project organization and deployment guidance

Resolution

The main consideration when designing a StreamBase project which will deliver data to LiveView Tables is whether the life-cycle of both will be identical, or whether the StreamBase application may run independently of the LiveView application and be stopped and started on a different schedule.

Note that StreamBase 7 projects upgraded to StreamBase 10 may have made use of module search path settings within the Workspace. These are no longer used in StreamBase 10 and the new approach is to use a maven dependency in the POM.
 

Same Life-Cycle

If the SB and LV applications share the same life-cycle, then the preferred design in Studio is to have one project only with both SB and LV assets. This is the simplest architecture. The SB applications are launched within the LiveView server in their own StreamBase containers (named by the "id" value) by using an application .lvconf file. An example of this can be found in the "Hello LiveView" sample file:
  sample_lv_sample_helloliveview/src/main/liveview/ItemsSalesDataSource.lvconf:
<liveview-configuration>
  <application filename="com.tibco.ldm.sample.lv_sample_helloliveview.itemssalesdatasource.application" id="ItemsSalesDataSource"/>
</liveview-configuration>
pointing to the SB module:
sample_lv_sample_helloliveview/src/main/eventflow/com.tibco.sample.lv_sample_helloliveview.itemssalesdatasource/application.sbapp

There are no Maven dependency concerns with this architecture and only one LiveView engine HOCON configuration (.conf file with type = "com.tibco.ep.ldm.configuration.ldmengine").

When SB and LV run together in the same server they share Java Heap memory, so memory size and garbage collection settings need to be tuned to accommodate both the physical RAM needed for table storage and a low-pause garbage collection policy. We recommend always enabling profile logging in production environments to provide the data needed to re-tune the memory when business requirements change (for example: longer history record, more updates per second, more clients, new queries, fewer machine resources, or new VM host).
 

Different Life-Cycle

If the SB and LV applications have different operating periods or need to be started and stopped on different maintenance cycles, then the preferred architecture is THREE separate fragment projects, an SB fragment, a LV fragment, and a second SB fragment for resources used by both. The most common shared resource is the SB Interface generated by Studio for each LV Table. Only the main SB and LV fragments will have their own application projects for deployment. The SB fragment with shared resources will not have an associated application project.

Project Setup

1. Create the separate SB and LV projects normally, and then create one additional SB project and copy the needed *.sbint files from the LV project into this third "shared resource" project. Remove them from the LV project so that you only have one set of the shared files to maintain.

2. Build the shared project by right-clicking the project in the Project Explorer and choosing menu item: Run As > Maven build..., in the dialog set Goals "clean install" and select check-box "Skip Tests", then Apply and Run.

3. Right-click on the StreamBase project in the Project Explorer and select menu item Maven > Enable Workspace Resolution. This allows the project to see the shared project's resources when there is no current build of the shared project.

4. Open the Maven pom.xml for the SB project and on the Dependencies tab, click the Add button and in the dialog search for the name of the shared project, select it in the list and click OK.

5. Repeat steps '3' and '4' for the LiveView project.

6. Complete the HOCON configuration normally for the SB and LV projects. There is no additional configuration needed for the shared project.
 

Runtime Considerations

Note that if the SB and LV applications will be run on the same system, for both applications either the HOCON configuration for the StreamBase Client API Listener (type = "com.tibco.ep.streambase.configuration.sbclientapilistener") or the 'epadmin install node' command will need to specify a different SB port.

Only nodes running the same application may co-exist in the same cluster, so when managing applications with different life-cycles, these are necessarily running in different and independent clusters. Communication between applications in different clusters cannot take advantage of a shared Transactional Memory store. Instead separate applications communicate over direct TCP using adapters, or via a message bus (EMS, JMS, FTL, Kafka, IBM WebSphere, or some other).