Interface SBServerManager
SBServerManager
provides control and access to a StreamBase Engine.
Obtain one via ServerManagerFactory
.- Since:
- 6.6
-
Method Summary
Modifier and TypeMethodDescriptionvoid
drain()
Wait for processing to complete on all currently enqueued tuples.getDequeuer
(String path) Get the Tuple dequeue object for a streamgetEnqueuer
(String path) Get the Tuple enqueue object for a streamgetTableAccessor
(String tablePath) Return a TableAccessor suitable for manipulating this table.getTableAccessor
(String tablePath, CaptureTransformStrategy captureStrategy) Return a TableAccessor suitable for manipulating this table.Return the current TimeService implementation used by the StreamBase EnginegetURI()
return the URI of the StreamBase Enginevoid
Load a module into the default container.void
Load a module into the specified container.void
loadAppString
(String appString, String container) Load an application (from a String) into the specified container.void
loadDeploy
(String deployFile) Load the given StreamBase deployment file.void
setTimeService
(TimeService timeService) Set a TimeService for the StreamBase Server managed by this Manager.void
Shutdown the StreamBase Engine, blocking until the StreamBase Engine is finished shutting downvoid
Start all the containers for this StreamBase Engine.void
startContainers
(Set<String> containersSuspendedOnStartup) Start all but the specified containers for this StreamBase Engine.void
startContainers
(Set<String> containersSuspendedOnStartup, boolean deferSubscriptions) Start all but the specified containers for this StreamBase Enginevoid
Start the StreamBase Engine, blocking until the StreamBase Engine will accept connectionsvoid
Stop all containers in this StreamBase Enginevoid
Subscribes to a stream.void
Subscribes to all streams
-
Method Details
-
getEnqueuer
Get the Tuple enqueue object for a stream- Parameters:
path
- the path to the stream. If this is not a full dotted path, assumes the stream has the given name and is in the default container.- Returns:
- Tuple enqueue object
- Throws:
StreamBaseException
- Error getting Tuple enqueue object
-
getDequeuer
Get the Tuple dequeue object for a stream- Parameters:
path
- the path to the stream. If this is not a full dotted path, assumes the stream has the given name and is in the default container.- Returns:
- Tuple dequeue object
- Throws:
StreamBaseException
- Error getting Tuple dequeue object
-
startServer
Start the StreamBase Engine, blocking until the StreamBase Engine will accept connections- Throws:
InterruptedException
- InterruptionStreamBaseException
- Error starting StreamBase Engine
-
shutdownServer
Shutdown the StreamBase Engine, blocking until the StreamBase Engine is finished shutting down- Throws:
InterruptedException
- InterruptionStreamBaseException
- Error stopping StreamBase Engine
-
loadApp
Load a module into the default container. The StreamBase Engine must be started prior to his call. Note that the module container will not be started (and thus no enqueues can be made to it) until a call tostartContainers()
(or similar methods) is made.The module must specified as a fully qualified module name, for example com.tibco.sample.myModule. The module is resolved using the StreamBase Engine's class path.
- Parameters:
fullyQualifiedModuleName
- A fully qualified module name- Throws:
StreamBaseException
- Error loading module- Since:
- 10.0 application argument must be a fully qualified module name
- See Also:
-
loadApp
Load a module into the specified container. The StreamBase Engine must be started prior to his call. Note that the module container will not be started (and thus no enqueues can be made to it) until a call tostartContainers()
(or similar methods) is made.The module must specified as a fully qualified module name, for example com.tibco.sample.myModule. The module is resolved using the StreamBase Engine's class path.
- Parameters:
fullyQualifiedModuleName
- A fully qualified module namecontainer
- The container name- Throws:
StreamBaseException
- Error loading module- Since:
- 10.0 application argument must be a fully qualified module name
- See Also:
-
loadAppString
Load an application (from a String) into the specified container. The StreamBase Engine must be started prior to his call. Note that the application container will not be started (and thus no enqueues can be made to it) until a call tostartContainers()
(or similar methods) is made.- Parameters:
appString
- A string which contains the text of an application (Eventflow or SSQL).container
- The container name- Throws:
StreamBaseException
- on failure to load the given application- Since:
- 7.0
- See Also:
-
loadDeploy
Load the given StreamBase deployment file. The StreamBase Engine must be started prior to this call. Note that the application containers will not be started until a call tostartContainers()
(or similar methods) is made.- Parameters:
deployFile
- Deployment file- Throws:
StreamBaseException
- Error loading deployment file- Since:
- 7.0
-
startContainers
Start all the containers for this StreamBase Engine. If no stream subscriptions have yet been specified, subscribes to all streams. To avoid this behavior, and instead subscribe to no streams, usestartContainers(Set, boolean)
with a false argument instead.- Throws:
StreamBaseException
- Error starting container- See Also:
-
startContainers
Start all but the specified containers for this StreamBase Engine. If subscriptions have previously been declared using calls to subscribe(), will only subscribe to the declared subscriptions. Otherwise, if no stream subscriptions have yet been specified, subscribes to all streams. To avoid this behavior, and instead subscribe to no streams, call startContainers(containersSuspendedOnStartup, true)- Parameters:
containersSuspendedOnStartup
- The containers to leave suspended, if null all containers will be started- Throws:
StreamBaseException
- Error starting containers- See Also:
-
startContainers
void startContainers(Set<String> containersSuspendedOnStartup, boolean deferSubscriptions) throws StreamBaseException Start all but the specified containers for this StreamBase Engine- Parameters:
containersSuspendedOnStartup
- The containers to leave suspended, if null all containers will be starteddeferSubscriptions
- when true, no output streams will be subscribed to- Throws:
StreamBaseException
- Error starting containers
-
subscribeAll
Subscribes to all streams- Throws:
StreamBaseException
- Error subscribing to streams
-
subscribe
Subscribes to a stream. This method is used to pre-declare the streams you are interested in prior to calling startContainers().- Parameters:
streamPath
- the path to the stream. If this is not a full dotted path, assumes the stream has the given name and is in the default container.- Throws:
StreamBaseException
- Error subscribing to stream
-
stopContainers
Stop all containers in this StreamBase Engine- Throws:
StreamBaseException
- Error stopping containers
-
drain
Wait for processing to complete on all currently enqueued tuples.A call to this method blocks until any tuples that were already enqueued in the StreamBase Engine have run through to completion, to the best effort of the StreamBase Engine. Upon return, any tuples that have reached output streams will be available for dequeue from
Dequeuer.dequeue(int)
.Note that for applications containing concurrent modules or operators, this method makes attempts to ensure it returns once all processing has completed, but does not guarantee this behavior.
- Throws:
StreamBaseException
- if an error occurs while draining; no guarantees are made about the state of pending tuples.- Since:
- 7.0.6
-
getURI
StreamBaseURI getURI()return the URI of the StreamBase Engine- Returns:
- URI of the StreamBase Engine
- Since:
- 7.0
-
getTableAccessor
Return a TableAccessor suitable for manipulating this table. This may only work with embedded StreamBase Engines. Capture fields in the table will be flattened.- Parameters:
tablePath
- Path to the table.- Returns:
- the TableAccessor
- Throws:
NotImplementedException
- if table accessors are not supported by this StreamBase Engine implementation.StreamBaseException
- if there is no table at that path, or if the table is inaccessible for any other reason.SemanticValidationException
- if the table is inaccessible because of a capture field naming conflict. In that case, call withCaptureTransformStrategy.NEST
- Since:
- 7.3
-
getTableAccessor
TableAccessor getTableAccessor(String tablePath, CaptureTransformStrategy captureStrategy) throws StreamBaseException Return a TableAccessor suitable for manipulating this table. This may only work with embedded StreamBase Engines.- Parameters:
tablePath
- Path to the table.captureStrategy
- Strategy for handling any capture fields in the table, either FLATTEN or NEST.- Returns:
- the TableAccessor
- Throws:
NotImplementedException
- if table accessors are not supported by this StreamBase Engine implementation.StreamBaseException
- if there is no table at that path, or if the table is inaccessible for any other reason.SemanticValidationException
- if the table is inaccessible because of a capture field naming conflict. In that case, call withCaptureTransformStrategy.NEST
- Since:
- 7.3
-
setTimeService
Set a TimeService for the StreamBase Server managed by this Manager. If this call succeeds the timeService object will be set as the current Server-wide time service so it will be shared by all the containers and modules in this StreamBase EngineThread safety note: you can call this method from any thread but you should make sure that it is not called from more than one thread at the same time. Otherwise the result is unpredictable.
- Parameters:
timeService
- a TimeService instance or null. If this is a valid TimeService instance it will be set as the current time service for the entire StreamBase Engine if this is null then StreamBase Engine will use the WallClockTimeService, which is the default TimeService implementation You should obtain a valid TimeService instance viaTimeServiceFactory
- Throws:
UnsupportedOperationException
- if there was a problem setting the time service- Since:
- 7.4
-
getTimeService
Return the current TimeService implementation used by the StreamBase EngineThread safety note: you can call this method from any thread but you should make sure that it is not called from more than one thread at the same time and while this method is called no other thread calls
setTimeService
method. Otherwise the result is unpredictable.- Returns:
- the current TimeService
- Throws:
StreamBaseException
- if there was a problem retrieving the current time service- Since:
- 7.4
-