Package com.streambase.sb.client
Class StreamBaseAdminClient
java.lang.Object
com.streambase.sb.client.BaseClient
com.streambase.sb.client.StreamBaseAdminClient
- All Implemented Interfaces:
AutoCloseable
This class is used to send administrative commands to the StreamBase Server
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Valid arguments for the listConnection command -
Constructor Summary
ConstructorDescriptionCreate a StreamBaseAdminClient.Create a StreamBaseAdminClient, connecting to the server at the provided URI.Create a StreamBaseAdminClient.Create a StreamBaseAdminClient.StreamBaseAdminClient
(List<StreamBaseURI> uris, ClientSettings settings) Create a StreamBaseAdminClient. -
Method Summary
Modifier and TypeMethodDescriptionString[]
addContainer
(String containerName, byte[] application, List<String> options) Add the given application to the given container in the StreamBase serverString[]
addContainer
(String containerName, File application, List<String> options) Add the given application to the given container in the StreamBase serverString[]
addContainer
(String containerName, String applicationText, List<String> options) Add the given application to the given container in the StreamBase serverString[]
Deprecated.Replaced with application fragments and HOCON configurationString[]
Deprecated.Replaced with application fragments and HOCON configurationString[]
Deprecated.Replaced with application fragments and HOCON configurationclearEvalCache
(String containerName) Clear evaluation cachevoid
close()
Close/shutdown the connection to the StreamBase server.void
drain()
Drain a StreamBase Server Has no effect if the server is not runningvoid
Drain a container within a StreamBase Server Has no effect if the server is not runningvoid
fastForwardTime
(String msecs) Fast forward timegetEvalCacheContent
(String containerName) Get evaluation cache contentgetMapperCacheContent
(String containerName) Get mapper cache contentsString[]
getOperatorProperties
(String operatorName) For the given Operator, return its set of properties and their values.getOperatorProperty
(String operatorName, String propertyName) Return the value of the given property on the given Operator.Get target timeString[]
Kill all of the connections on the serverString[]
killConnection
(byte[] connectionId) Kill the connection with the given connectionIdString[]
Return an array of client connectionsString[]
listEntities
(String entityType, int flags) Return an array of entity names for the given entity typeString[]
manageJdbcConnections
(List<String> args) Manage JDBC connections: count [name]Count the open JDBC connections to the named data source (or all data sources if ommitted) close [name]Close any open JDBC connections to the named data source (or all data sources if ommitted)String[]
modifyContainer
(String containerName, List<String> options) Modifies the given container.String[]
removeContainer
(String containerName, String... args) Remove the given container in the StreamBase serverString[]
restartContainer
(String containerName) Restart a containervoid
restartOperators
(List<String> operatorNames) Restart the given Operators on the StreamBase server.void
Resume a container in a StreamBase servervoid
resumeOperators
(List<String> operatorNames) Resume the given Operators on the StreamBase servervoid
setOperatorProperty
(String operatorName, String propertyName, String value) On the given Operator, set the given property to the given value.void
setRuntimeParam
(String paramName, String paramValue, String operator) Set a runtime parameter on one, or all, operators.shutdown()
Shutdown a StreamBase serverShutdown a container within a StreamBase servervoid
shutdownOperators
(List<String> operatorNames) Shut down the given Operators on the StreamBase server.void
Suspend (pause) a container or operator within a StreamBase Servervoid
suspendOperators
(List<String> operatorNames) Suspend (pause) the given Operators on the StreamBase ServerMethods inherited from class com.streambase.sb.client.BaseClient
getSettings, getURI, getURIs, haModeOn, operatorStatus, status, status
-
Constructor Details
-
StreamBaseAdminClient
Create a StreamBaseAdminClient. Uses the value of the "streambase.uri" property as the URI, orStreamBaseURI.DEFAULT_URI
if this property is undefined.- Throws:
StreamBaseException
- on connect error, malformed URI, etc.- See Also:
-
StreamBaseAdminClient
Create a StreamBaseAdminClient, connecting to the server at the provided URI.- Parameters:
uri
- server address- Throws:
StreamBaseException
- on connect error- See Also:
-
StreamBaseAdminClient
Create a StreamBaseAdminClient.- Parameters:
uri
- The uri to use of the form: sb://address:port. SeeStreamBaseURI
- Throws:
StreamBaseException
- on connect error, malformed URI, etc.- See Also:
-
StreamBaseAdminClient
Create a StreamBaseAdminClient.- Parameters:
uris
- a list of StreamBaseURIs. Note: The StreamBaseAdminClient only supports one URI in the list.- Throws:
StreamBaseException
- on connect error, malformed URI, etc.- See Also:
-
StreamBaseAdminClient
public StreamBaseAdminClient(List<StreamBaseURI> uris, ClientSettings settings) throws StreamBaseException Create a StreamBaseAdminClient.- Parameters:
uris
- a list of StreamBaseURIs. Note: The StreamBaseAdminClient only supports one URI in the list.settings
- client settings- Throws:
StreamBaseException
- on connect error, malformed URI, etc.- Since:
- 7.1
- See Also:
-
-
Method Details
-
close
public void close()Close/shutdown the connection to the StreamBase server.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in classBaseClient
-
addDeploy
Deprecated.Replaced with application fragments and HOCON configurationAdd the given deployment file to the server given the text of the file- Parameters:
deployText
- String contents of a deployment configuration file (.sbdeploy
file)args
- a list of options for the command. Valid options include:- [--verbose]
- returns a string indicating a succesful operation
sbadmin
command and the documentation for additional details- Returns:
- array of informational results from the server or empty array if no results
- Throws:
StreamBaseException
- deployment file error- Since:
- 7.0
- See Also:
-
addDeploy
Deprecated.Replaced with application fragments and HOCON configurationAdd the given deployment file to the server given the byte content of the file.- Parameters:
deployText
- byte contents of a file that specifies a deployment configuration: a.sbdeploy
(StreamBase Deployment) file or a.sbar
(StreamBase Archive) file. If it is a StreamBase Archive file, the file must have been created by runningsbargen
on an.sbdeploy
file.args
- a list of options for the command. Valid options include:- [--verbose]
- returns a string indicating a succesful operation
sbadmin
command and the documentation for additional details- Returns:
- array of informational results from the server or empty array if no results
- Throws:
StreamBaseException
- error adding deploy file- Since:
- 7.0
- See Also:
-
addDeploy
@Deprecated public String[] addDeploy(File deployFile, String... options) throws StreamBaseException Deprecated.Replaced with application fragments and HOCON configurationAdds applications and containers defined in the given deployment or archive file to the StreamBase server.- Parameters:
deployFile
- File that specifies a deployment configuration: a.sbdeploy
(StreamBase Deployment) file or a.sbar
(StreamBase Archive) file. If it is a StreamBase Archive file, the file must have been created by runningsbargen
on an.sbdeploy
file.options
- a list of options for the added command. Valid options include:- [--verbose]
- returns a string indicating a succesful operation
sbadmin
command and the documentation for additional details- Returns:
- array of informational results from the server or empty array if no results
- Throws:
StreamBaseException
- if the deployment file is invalid, any of the containers that would be added is invalid, or there is a name collision that prevents a container from being added.- Since:
- 7.0
-
addContainer
public String[] addContainer(String containerName, String applicationText, List<String> options) throws StreamBaseException Add the given application to the given container in the StreamBase server- Parameters:
containerName
- the container name to add the application underapplicationText
- contents of an application: xml from an EventFlow application, or StreamSQL text. The character set is assumed UTF-8.options
- List of options for the added container. SeeaddContainer(String, byte[], List)
for details.- Returns:
- array of informational results from the server or empty array if no results
- Throws:
StreamBaseException
- thrown on typecheck and other errors- Since:
- 6.4 --parameter
-
addContainer
public String[] addContainer(String containerName, byte[] application, List<String> options) throws StreamBaseException Add the given application to the given container in the StreamBase server- Parameters:
containerName
- the container name to add the application underapplication
- contents of an application: binary content from a.sbar
file, xml from an EventFlow application, or StreamSQL text. The character set is assumed UTF-8.options
- a list of options for the added container. Valid options include:- newContainer.newStream=oldContainer.oldStream
- sets up a cross-container connection. You may specify more than one of this option.
- --parameter=paramName=paramValue
- sets a module parameter (or overrides a default value) for this container's top level application. You may specify more than one of this option.
- --suspend
- sets the container to the suspended state when added
- --enqueue=STREAMSTATUS, --dequeue=STREAMSTATUS
- sets the enqueue or dequeue status for this container. STREAMSTATUS is one of ENABLED, DISABLED, DROP_TUPLES. You may specify each option at most once.
- --moduleSearch=DIR
- adds a directory for the server to locate modules in while adding this container. You may specify more than one of this option.
- --datadir=DIR
- sets the data directory for this container. You may specify this option only once.
- --traceStreamPattern=pattern, --traceFileBase=basefilename, --traceCompress, --traceOverwrite
- sets options for runtime tracing for this container. Please see the documentation for details on how to enable and configure runtime tracing
- [--verbose]
- returns a string indicating a successsful operation
sbadmin
command and the documentation for additional details on container options.- Returns:
- array of informational results from the server or empty array if no results
- Throws:
StreamBaseException
- thrown on typecheck and other errors- Since:
- 6.4 added additional tracing options, and the ability to set module parameters for the top-level container application
-
addContainer
public String[] addContainer(String containerName, File application, List<String> options) throws StreamBaseException Add the given application to the given container in the StreamBase server- Parameters:
containerName
- the container name to add the application underapplication
- File that specifies an application: a.sbar
file, an EventFlow application, or a StreamSQL application text.options
- List of options for the added container. SeeaddContainer(String, byte[], List)
for details- Returns:
- array of informational results from the server or empty array if no results
- Throws:
StreamBaseException
- thrown on typecheck and other errors- Since:
- 6.2
-
getOperatorProperties
For the given Operator, return its set of properties and their values.- Parameters:
operatorName
- The operator whose properties are retrieved.- Returns:
- array of results or empty array if no results
- Throws:
StreamBaseException
- error getting properties
-
getOperatorProperty
public String getOperatorProperty(String operatorName, String propertyName) throws StreamBaseException Return the value of the given property on the given Operator.- Parameters:
operatorName
- The operator whose property value is retrieved.propertyName
- The property whose value is retrieved.- Returns:
- the value of the operator property
- Throws:
StreamBaseException
- error getting properties
-
setOperatorProperty
public void setOperatorProperty(String operatorName, String propertyName, String value) throws StreamBaseException On the given Operator, set the given property to the given value.- Parameters:
operatorName
- The operator whose property value is set.propertyName
- The property whose value is set.value
- The value set.- Throws:
StreamBaseException
- error setting properties
-
removeContainer
Remove the given container in the StreamBase server- Parameters:
containerName
- the containerNameargs
- a list of options for the command. Valid options include:- [--verbose]
- returns a string indicating a succesful operation
sbadmin
command and the documentation for additional details- Returns:
- array of informational results from the server or empty array if no results
- Throws:
StreamBaseException
- thrown on error
-
restartOperators
Restart the given Operators on the StreamBase server. The Operators must currently be shut down.- Parameters:
operatorNames
- names of operators to restart- Throws:
StreamBaseException
- error restarting operators
-
restartContainer
Restart a container- Parameters:
containerName
- Container name- Returns:
- Results if any
- Throws:
StreamBaseException
- Error restarting container
-
fastForwardTime
Fast forward time- Parameters:
msecs
- Forward by this number of milliseconds- Throws:
StreamBaseException
- Error fast forwarding time
-
getTargetTime
Get target time- Returns:
- Target time value
- Throws:
StreamBaseException
- Error getting target time
-
getEvalCacheContent
Get evaluation cache content- Parameters:
containerName
- Container name- Returns:
- Cache contents
- Throws:
StreamBaseException
- Error accessing evaluation cache
-
clearEvalCache
Clear evaluation cache- Parameters:
containerName
- Container name- Returns:
- Results if any
- Throws:
StreamBaseException
- Error clearing evaluation cache
-
getMapperCacheContent
Get mapper cache contents- Parameters:
containerName
- Container name- Returns:
- Cache contents
- Throws:
StreamBaseException
- Error accessing cache
-
resumeOperators
Resume the given Operators on the StreamBase server- Parameters:
operatorNames
- names of operators to resume- Throws:
StreamBaseException
- error resuming operators
-
resume
Resume a container in a StreamBase server- Parameters:
containerName
- the name of the container- Throws:
StreamBaseException
- error resuming container
-
shutdown
Shutdown a StreamBase server- Returns:
- a message describing the outcome
- Throws:
StreamBaseException
- thrown on network or other errors
-
shutdown
Shutdown a container within a StreamBase server- Parameters:
containerName
- the name of the container- Returns:
- a message describing the outcome
- Throws:
StreamBaseException
- thrown on network or other errors
-
shutdownOperators
Shut down the given Operators on the StreamBase server.- Parameters:
operatorNames
- name of operators to shut down- Throws:
StreamBaseException
- error shutting down operators
-
suspendOperators
Suspend (pause) the given Operators on the StreamBase Server- Parameters:
operatorNames
- names of operators to suspend- Throws:
StreamBaseException
- thrown on network or other errors
-
suspend
Suspend (pause) a container or operator within a StreamBase Server- Parameters:
name
- the name of the container or operator- Throws:
StreamBaseException
- thrown on network or other errors
-
drain
Drain a StreamBase Server Has no effect if the server is not running- Throws:
StreamBaseException
- thrown on network or other errors
-
drain
Drain a container within a StreamBase Server Has no effect if the server is not running- Parameters:
containerName
- the name of the container- Throws:
StreamBaseException
- thrown on network or other errors
-
listConnections
public String[] listConnections(StreamBaseAdminClient.ListConnectionArgument... args) throws StreamBaseException Return an array of client connections- Parameters:
args
- arguments for the command- Returns:
- an array of client connections
- Throws:
StreamBaseException
- thrown on network or other errors
-
listEntities
Return an array of entity names for the given entity type- Parameters:
entityType
- the entity type to do the lookupflags
- FULLY_QUALIFIED_NAMES and INCLUDE_MODULES flags- Returns:
- an array of entity names for the given entity type
- Throws:
StreamBaseException
- thrown on network or other errors
-
killAllConnections
Kill all of the connections on the server- Returns:
- status of kill command
- Throws:
StreamBaseException
- error killing connections
-
killConnection
Kill the connection with the given connectionId- Parameters:
connectionId
- connection identifier- Returns:
- status of kill command
- Throws:
StreamBaseException
- error killing connection
-
manageJdbcConnections
Manage JDBC connections:- count [name]
- Count the open JDBC connections to the named data source (or all data sources if ommitted)
- close [name]
- Close any open JDBC connections to the named data source (or all data sources if ommitted)
- Parameters:
args
- a list that must contain at least one command string (close
orcount
), and may contain an optional second argument string (the name of a data source). When no argument string is given, the command will apply to all data sources.- Returns:
- for
close
, one string containing the number of connections closed. forcount
, one string containing the number of open connections - Throws:
StreamBaseException
- throw on network or other errors- Since:
- 7.2
-
setRuntimeParam
public void setRuntimeParam(String paramName, String paramValue, String operator) throws StreamBaseException Set a runtime parameter on one, or all, operators. If the operator name is null, the parameter is changed on all operators.- Parameters:
paramName
- the runtime parameter name to modifyparamValue
- the new valueoperator
- the target operator to notify for this parameter change, or null to notify all operators- Throws:
StreamBaseException
- thrown on network or other errors
-
modifyContainer
public String[] modifyContainer(String containerName, List<String> options) throws StreamBaseException Modifies the given container. Only one command may be issued per method invocation.- Parameters:
containerName
- the container name to modifyoptions
- a modify command String as the first entry, and any arguments required by that command as subsequent String entries. Valid modify commands and arguments are:- [addConnection|removeConnection] destinationContainer.destinationStream=sourceContainer.sourceStream
- adds or removes an asynchronous container connection specified by this command's argument
- [addConnection|removeConnection] destinationContainer.destinationStream:=sourceContainer.sourceStream
- adds or removes a synchronous container connection specified by this command's argument
- [--enqueue=STREAMSTATUS|--dequeue=STREAMSTATUS]
- sets the enqueue or dequeue status for this container. STREAMSTATUS is one of ENABLED, DISABLED, DROP_TUPLES. You may only specify one option per invocation of this method.
- trace [--traceStreamPattern=pattern] [--traceFileBase=baseFilename] [--traceOverwrite] [--traceCompress] [true|false]
- Enables runtime tracing using the provided tracing options, or disable tracing for this container. The last argument must be one of
true
orfalse
. - --traceFileBase=basefilename
- Changes the trace filename prefix
- [--traceOverwrite|--traceCompress] [true|false]
- Enables or disables overwriting and compressing of trace files
- [--verbose]
- reports a successful modifyContainer call
sbadmin
command and the documentation for additional details on container options.- Returns:
- array of informational results from the server or empty array if no results
- Throws:
StreamBaseException
- thrown on errors- Since:
- 6.4 added tracing options
-