How to embed StreamBase Server into a third party application

How to embed StreamBase Server into a third party application

book

Article ID: KB0076356

calendar_today

Updated On:

Products Versions
TIBCO Streaming 7.x

Description

How to embed StreamBase Server into a third party application?

Issue/Introduction

How to embed StreamBase Server into a third party application

Resolution

Important
This only applies to TIBCO StreamBase version 7.7 and prior. This is not supported for TIBCO Streaming version 10.0 and following.
The pattern for embedding StreamBase Server is exactly the same as running a StreamBase Server instance in a single JUnit test. In the Java API Guide see the com.streambase.sb.unittest.SBServerManager class.

Here's an example skeleton of a class using this approach:
package com.sb.support.embedded;

import com.streambase.sb.unittest.SBServerManager;
import com.streambase.sb.unittest.ServerManagerFactory;

public class SBEmbed {
    private static SBServerManager server;
    public static void setupServer() throws Exception {
        // create a StreamBase server and load container applications
        server = ServerManagerFactory.getEmbeddedServer();
        server.startServer();
        server.loadDeploy("main.sbdeploy");
    }
    public static void stopServer() throws Exception {
        if (server != null) {
        server.shutdownServer();
        server = null;
        }
    }
}

The call to start up the main.sbdeploy containers is: SBEmbed.setupServer();