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