public interface SBServerManager
SBServerManager
provides control and access to a StreamBase server.
Obtain one via ServerManagerFactory
.Modifier and Type | Method and Description |
---|---|
void |
drain()
Wait for processing to complete on all currently enqueued tuples.
|
Dequeuer |
getDequeuer(String path)
Get the dequeuer for this stream
|
Enqueuer |
getEnqueuer(String path)
Get the enqueuer for this stream
|
TableAccessor |
getTableAccessor(String tablePath)
Return a TableAccessor suitable for manipulating this table.
|
TableAccessor |
getTableAccessor(String tablePath,
CaptureTransformStrategy captureStrategy)
Return a TableAccessor suitable for manipulating this table.
|
TimeService |
getTimeService()
Return the current TimeService implementation used by StreamBase server
|
StreamBaseURI |
getURI()
return the URI of the server
|
void |
loadApp(String appFile)
Load an application into the default container.
|
void |
loadApp(String appFile,
String container)
Load an application 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 |
shutdownServer()
Shutdown the server, blocking until the server is finished shutting down
|
void |
startContainers()
Start all the containers for this server.
|
void |
startContainers(Set<String> containersSuspendedOnStartup)
Start all but the specified containers for this server.
|
void |
startContainers(Set<String> containersSuspendedOnStartup,
boolean deferSubscriptions)
Start all but the specified containers for this server
|
void |
startServer()
Start the server, blocking until the server will accept connections
|
void |
stopContainers()
Stop all containers in this server
|
void |
subscribe(String streamPath)
Subscribes to a stream.
|
void |
subscribeAll()
Subscribes to all streams
|
Enqueuer getEnqueuer(String path) throws StreamBaseException
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.StreamBaseException
Dequeuer getDequeuer(String path) throws StreamBaseException
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.StreamBaseException
void startServer() throws InterruptedException, StreamBaseException
void shutdownServer() throws InterruptedException, StreamBaseException
void loadApp(String appFile) throws StreamBaseException
SBServerManager.startContainers()
(or similar methods) is made.appFile
- The file name to be loaded. This must be a simple name, that
is resolved against the server's module search path.StreamBaseException
- on failure to load the given applicationSBServerManager.startServer()
,
SBServerManager.startContainers()
void loadApp(String appFile, String container) throws StreamBaseException
SBServerManager.startContainers()
(or similar methods) is made.appFile
- The file name to be loaded. This must be a simple name, that
is resolved against the server's module search path.container
- The container nameStreamBaseException
- on failure to load the given applicationSBServerManager.startServer()
,
SBServerManager.startContainers()
void loadAppString(String appString, String container) throws StreamBaseException
SBServerManager.startContainers()
(or similar methods) is made.appString
- A string which contains the text of an application (Eventflow or SSQL).container
- The container nameStreamBaseException
- on failure to load the given applicationSBServerManager.startServer()
,
SBServerManager.startContainers()
void loadDeploy(String deployFile) throws StreamBaseException
SBServerManager.startContainers()
(or similar methods)
is made.StreamBaseException
void startContainers() throws StreamBaseException
SBServerManager.startContainers(Set, boolean)
with a false argument instead.void startContainers(Set<String> containersSuspendedOnStartup) throws StreamBaseException
containersSuspendedOnStartup
- The containers to leave suspended, if null all containers will be startedStreamBaseException
SBServerManager.startContainers(Set, boolean)
void startContainers(Set<String> containersSuspendedOnStartup, boolean deferSubscriptions) throws StreamBaseException
containersSuspendedOnStartup
- The containers to leave suspended, if null all containers will be starteddeferSubscriptions
- when true, no output streams will be subscribed toStreamBaseException
void subscribeAll() throws StreamBaseException
StreamBaseException
void subscribe(String streamPath) throws StreamBaseException
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.StreamBaseException
void stopContainers() throws StreamBaseException
StreamBaseException
void drain() throws StreamBaseException
A call to this method blocks until any tuples that were already
enqueued in the server have run through to completion, to the best
effort of the server. 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.
StreamBaseException
- if an error occurs while draining; no
guarantees are made about the state of pending tuples.StreamBaseURI getURI()
TableAccessor getTableAccessor(String tablePath) throws StreamBaseException
tablePath
- Path to the table.NotImplementedException
- if table accessors are not supported by this server
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 with
CaptureTransformStrategy.NEST
TableAccessor getTableAccessor(String tablePath, CaptureTransformStrategy captureStrategy) throws StreamBaseException
tablePath
- Path to the table.captureStrategy
- Strategy for handling any capture fields in the table, either
FLATTEN or NEST.NotImplementedException
- if table accessors are not supported by this server
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 with
CaptureTransformStrategy.NEST
void setTimeService(TimeService timeService)
Thread 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.
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 server
if this is null then StreamBase server will use the WallClockTimeService, which
is the default TimeService implementation
You should obtain a valid TimeService instance via TimeServiceFactory
UnsupportedOperationException
- if there was a problem setting the server-wide time serviceTimeService getTimeService() throws StreamBaseException
Thread 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.
StreamBaseException
- if there was a problem retrieving the current server-wide time service