Jump to content
  • How to embed StreamBase Server into a third party application


    Issue

    How to embed StreamBase Server into a third party application?

    Solution

    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();


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...