public class StreamBaseClient
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
StreamBaseClient.ListEntityFlags
Flags used by the ListEntities call.
|
class |
StreamBaseClient.SerializedTupleBuffer
A TupleBuffer which contains a byte buffer of serialized tuples
including space for a network header
|
class |
StreamBaseClient.TupleBuffer
Class for abstracting away where tuples come from, Buffers, Collections, and Single Enqueues.
|
Constructor and Description |
---|
StreamBaseClient()
Create a StreamBaseClient.
|
StreamBaseClient(java.util.List<StreamBaseURI> uris)
Create a StreamBaseClient, connecting to the servers at the provided URIs.
|
StreamBaseClient(java.util.List<StreamBaseURI> uris,
ClientSettings settings)
Create a StreamBaseClient, connecting to the servers at the provided URIs.
|
StreamBaseClient(StreamBaseURI uri)
Create a StreamBaseClient, connecting to the server at the provided URI
|
StreamBaseClient(java.lang.String uriStrings)
Create a StreamBaseClient from one or more comma-separated URI strings
|
Modifier and Type | Method and Description |
---|---|
void |
addConnectionStatusCallback(ConnectionStatusCallback callback)
Track changes to the connection state.
|
protected static java.lang.String |
assureNameStartsWithContainer(StreamProperties base,
java.lang.String logicalName) |
boolean |
canDequeue()
Return true if we can call dequeue without blocking.
|
protected static void |
checkValidStreamname(java.lang.String streamname) |
void |
close()
close the client
|
void |
close(java.lang.String msg)
Flush all buffers and close the connection to the StreamBase server.
|
DequeueResult |
dequeue()
Dequeue a batch of tuples from a subscribed stream.
|
DequeueResult |
dequeue(long timeoutMS)
Dequeue a batch of tuples from a subscribed stream.
|
java.lang.String |
describe(java.lang.String entityName)
Return an XML description of a StreamBase entity
|
void |
enableBuffering(int bufferSize)
Turn on buffering with a default WakeAndFlushBuffer thread set to 250ms
|
void |
enableBuffering(int bufferSize,
long flushIntervalMilliSeconds)
Turn on buffering.
|
void |
enqueue(StreamProperties props,
java.util.Collection<Tuple> tuples)
Enqueue a collection of Tuples onto a stream.
|
void |
enqueue(StreamProperties props,
Tuple tuple)
Enqueue a single Tuple onto a stream.
|
void |
enqueue(java.lang.String stream,
java.util.Collection<Tuple> tuples)
Enqueue a collection of Tuples onto a stream.
|
void |
enqueue(java.lang.String stream,
Tuple tuple)
Enqueue a single Tuple onto a stream.
|
void |
flushAllBuffers()
Flush any pending enqueue buffers.
|
void |
flushBuffer(StreamProperties props)
Deprecated.
use
StreamBaseClient.flushAllBuffers() to preserve inter-stream ordering |
void |
flushBuffer(java.lang.String stream_name)
Deprecated.
use
StreamBaseClient.flushAllBuffers() to preserve inter-stream ordering |
java.util.Set<StreamProperties> |
getAllStreamProperties(EntityType type)
Return all the StreamProperties available.
|
java.util.Set<StreamProperties> |
getAllStreamProperties(EntityType type,
CaptureTransformStrategy strategy)
Return all the StreamProperties available
|
java.lang.String |
getConnectionError()
If the StreamBaseClient disconnected due to an internal error, return a message corresponding
to the error, otherwise return null.
|
byte[] |
getConnectionID()
Return the Connection ID for this Client Connection.
|
ConnectionStatus |
getConnectionStatus()
Return the current connection status of this StreamBaseClient.
|
DequeueResult.Interceptor |
getDequeueResultsInterceptor()
Get the current dequeue results interceptor, or null if there is no
current processor.
|
java.lang.Object |
getDynamicVariable(java.lang.String dynamicVariablePath)
Get the given dynamic variable
|
Tuple |
getDynamicVariables(java.lang.String modulePath)
Get a Tuple of all the dynamic variables on the given module
|
int |
getEnqueueBufferSize()
Return the number of tuples in the enqueue buffer
|
Schema |
getSchemaByHash(byte[] hash)
Return the Schema object for the given hash value
|
Schema |
getSchemaByName(java.lang.String name)
Return the Schema object for the given name.
|
Schema |
getSchemaForStream(java.lang.String streamName)
Return the schema of a stream.
|
ClientSettings |
getSettings()
Return the settings for this client
|
StreamProperties |
getStreamProperties(java.lang.String streamName)
Return the StreamProperties for the given stream name
|
StreamProperties |
getStreamProperties(java.lang.String streamName,
CaptureTransformStrategy strategy)
Return the StreamProperties for the given stream name
|
StreamProperties |
getStreamPropertiesByHash(byte[] hash)
Return the StreamProperties for the given hash
StreamProperties are cached locally in the client.
|
StreamProperties |
getStreamPropertiesByHash(java.lang.String hashHexString)
Return the StreamProperties for the given hash
StreamProperties are cached locally in the client.
|
java.util.Set<java.lang.String> |
getSubscribedStreamNames()
Returns a Set of names of the Streams this client is currently subscribed
to.
|
long |
getTupleDequeueCount()
Returns the number of tuples this client has dequeued from the server.
|
long |
getTupleEnqueueCount()
Returns the number of tuples this client has actually enqueued to the server.
|
StreamBaseURI |
getURI()
Return the URI used by this Client.
|
java.util.List<StreamBaseURI> |
getURIs()
get all of the URI's for this client
|
static java.lang.String |
getVersion()
Get the version of this client, returned in the format specified by
Version.INFO_LINE |
protected boolean |
haModeOn()
is HA mode on
|
boolean |
hasSchema(java.lang.String schemaName)
Returns whether or not a schema with the passed in schemaName is available;
you can get this Schema by calling getSchemaByName.
|
boolean |
hasStream(java.lang.String streamName)
Returns whether or not the client has a stream with the
passed in name.
|
boolean |
hasStreamProperties(java.lang.String streamName)
Returns whether or not a stream with the given name exists.
|
boolean |
isClosed()
Return true if the client connection is closed.
|
boolean |
isSubscribed(StreamProperties stream)
Return status if we are subscribed to the given stream
|
java.lang.String[] |
listEntities(EntityType entityType)
Return an array of entity names for the given entity type.
|
java.lang.String[] |
listEntities(EntityType entityType,
CaptureTransformStrategy strategy)
Return an array of entity names for the given entity type.
|
java.lang.String[] |
listEntities(EntityType entityType,
int flags)
Return an array of entity names for the given entity type and flags.
|
java.lang.String[] |
listEntities(EntityType entityType,
int flags,
CaptureTransformStrategy strategy)
Return an array of entity names for the given entity type and flags.
|
java.lang.String[] |
listEntities(java.lang.String entityPath,
int flags)
Return an array of entity names for the given entity path.
|
java.lang.String[] |
listEntities(java.lang.String entityPath,
int flags,
CaptureTransformStrategy strategy)
Return an array of entity names for the given entity path.
|
java.lang.String[] |
operatorStatus(java.lang.String containerName)
Return the status of all the operators in the specified container
|
java.util.List<Tuple> |
readTable(java.lang.String tablePath,
int rowLimit)
Return rows from a Query Table or Materialized Window.
|
java.util.List<Tuple> |
readTable(java.lang.String tablePath,
int rowLimit,
java.lang.String predicate)
Return rows from a Query Table or Materialized Window, applying an optional predicate to decide which rows are returned.
|
void |
removeConnectionStatusCallback(ConnectionStatusCallback callback)
Stop tracking changes to the connection state.
|
StreamProperties |
resubscribe(StreamProperties props,
java.lang.String logicalstream,
java.lang.String predicate)
Resubscribe to a stream with a predicate.
|
StreamProperties |
resubscribe(java.lang.String streamname,
java.lang.String logicalstream,
java.lang.String predicate)
Resubscribe to a stream with a predicate.
|
protected void |
setConnectionStatus(ConnectionStatus status,
java.lang.String additionalInfo) |
DequeueResult.Interceptor |
setDequeueResultInterceptor(DequeueResult.Interceptor dri)
Set the dequeue results interceptor for this client connection.
|
void |
setDynamicVariable(java.lang.String dynvarPath,
java.lang.Object value)
Set the given dynamic variable to a new value
|
void |
setQuiescentLimit(long timeoutMS)
If more then timeoutMS milliseconds elapse without receiving data or a
heart beat from the server, the client will close.
|
java.lang.String[] |
status()
Return the status of the StreamBase Server
|
java.lang.String[] |
status(boolean verbose)
Return the status of the StreamBase Server
|
StreamProperties |
subscribe(StreamProperties props)
Subscribe to a stream
|
StreamProperties |
subscribe(StreamProperties props,
java.lang.String logicalstream,
java.lang.String predicate)
Subscribe to a stream with a predicate.
|
StreamProperties |
subscribe(java.lang.String streamname)
Subscribe to a stream
|
StreamProperties |
subscribe(java.lang.String streamName,
CaptureTransformStrategy strategy)
Subscribe to a stream
|
StreamProperties |
subscribe(java.lang.String streamName,
CaptureTransformStrategy strategy,
java.lang.String logicalstream,
java.lang.String predicate)
Subscribe to a stream with a predicate.
|
StreamProperties |
subscribe(java.lang.String streamname,
java.lang.String logicalstream,
java.lang.String predicate)
Subscribe to a stream with a predicate.
|
StreamProperties[] |
typecheck(java.lang.String application)
Typecheck (validate) the given StreamBase Application.
|
StreamProperties[] |
typecheck(java.lang.String application,
boolean full)
Typecheck (validate) the given StreamBase Application.
|
void |
unsubscribe(StreamProperties logicalProps)
Unsubscribe from the given stream name.
|
void |
unsubscribe(java.lang.String logicalStreamName)
Unsubscribe from the given stream name.
|
protected void |
unsubscribeInternal(StreamProperties logicalProps) |
public StreamBaseClient(java.lang.String uriStrings) throws StreamBaseException
uriStrings
- The URIs to use, in string form; e.g.,
"sb://localhost:10000" or "sb://host1:10000,sb://host2"StreamBaseException
- on connect errorURIException
- on malformed or invalid URIStreamBaseURI
public StreamBaseClient() throws StreamBaseException, URIException
streambase.uri
property, or the system environment variable STREAMBASE_SERVER
,
or StreamBaseURI.DEFAULT_URI
if neither is defined.StreamBaseException
- on connect errorURIException
- on malformed or invalid URIStreamBaseURI.fromEnvironment()
public StreamBaseClient(StreamBaseURI uri) throws StreamBaseException
uri
- The uri to connect toStreamBaseException
- on connect errorStreamBaseURI
public StreamBaseClient(java.util.List<StreamBaseURI> uris) throws StreamBaseException
uris
- a list of URIs to connect toStreamBaseException
- on connect errorStreamBaseURI
public StreamBaseClient(java.util.List<StreamBaseURI> uris, ClientSettings settings) throws StreamBaseException
uris
- a list of URIs to connect tosettings
- client settingsStreamBaseException
- on connect errorStreamBaseURI
public void close() throws StreamBaseException
close
in interface java.lang.AutoCloseable
StreamBaseException
public void close(java.lang.String msg) throws StreamBaseException
msg
- StreamBaseException
public boolean canDequeue()
public boolean isClosed()
public DequeueResult dequeue() throws StreamBaseException
StreamBaseException
- thrown on network or other errorspublic DequeueResult dequeue(long timeoutMS) throws StreamBaseException
StreamBaseException
- thrown on network or other errorspublic DequeueResult.Interceptor setDequeueResultInterceptor(DequeueResult.Interceptor dri)
public DequeueResult.Interceptor getDequeueResultsInterceptor()
public java.lang.String describe(java.lang.String entityName) throws StreamBaseException
entityName
- the name of the entity to describeStreamBaseException
- thrown on network or other errorspublic void enableBuffering(int bufferSize, long flushIntervalMilliSeconds) throws StreamBaseException
bufferSize
- specifies the number of tuples to buffer before enqueueing. If set to a non-positive value, this call has no effectflushIntervalMilliSeconds
- specifies the interval in milliseconds between wakeups of WakeAndFlushBufferStreamBaseException
- thrown on network or other errorspublic void enableBuffering(int bufferSize) throws StreamBaseException
bufferSize
- specifies the number of tuples to buffer before enqueueing. if a non-positive value is given, this call has no effectStreamBaseException
- thrown on network or other errorsStreamBaseClient.enableBuffering(int, long)
public void enqueue(java.lang.String stream, Tuple tuple) throws StreamBaseException
Performance note: this method should be avoided where possible. Use
StreamBaseClient.enqueue(StreamProperties, Tuple)
instead.
stream
- the name of the stream on which to enqueue the provided tuple.tuple
- the Tuple to enqueueStreamBaseException
- thrown on network or other errorsStreamBaseClient.enqueue(StreamProperties, Tuple)
public void enqueue(StreamProperties props, Tuple tuple) throws StreamBaseException
props
- the StreamProperties for the stream to enqueue the tuple totuple
- the Tuple to enqueueStreamBaseException
- thrown on network or other errorspublic void enqueue(java.lang.String stream, java.util.Collection<Tuple> tuples) throws StreamBaseException
Performance note: this method should be avoided where possible. Use
StreamBaseClient.enqueue(StreamProperties, Collection)
instead.
stream
- the name of the stream on which to enqueue the provided tuples.tuples
- a Collection of Tuples to enqueue. Note that the tuples will be
modified as part of enqueueStreamBaseException
- thrown on network or other errorsStreamBaseClient.enqueue(StreamProperties, Collection)
public void enqueue(StreamProperties props, java.util.Collection<Tuple> tuples) throws StreamBaseException
props
- the StreamProperties for the stream to enqueue the tuples totuples
- a Collection of Tuples to enqueue. Note that the tuples will be
modified as part of enqueueStreamBaseException
- thrown on network or other errorspublic void flushAllBuffers() throws StreamBaseException
StreamBaseException
- if there is an IO error while flushing the bufferpublic void flushBuffer(java.lang.String stream_name) throws StreamBaseException
StreamBaseClient.flushAllBuffers()
to preserve inter-stream orderingNote: Note that this will cause inter-stream ordering to be interrupted.
stream_name
- the stream whose enqueue buffers to flush, if not emptyStreamBaseException
- if there is an IO error while flushing the bufferpublic void flushBuffer(StreamProperties props) throws StreamBaseException
StreamBaseClient.flushAllBuffers()
to preserve inter-stream orderingStreamProperties
provided.
This operation has no effect if buffering is not enabled or there is no buffer
to flush for the given stream.
Note: Note that this will cause inter-stream ordering to be interrupted.
props
- the stream whose enqueue buffers to flush, if not emptyStreamBaseException
- if there is an IO error while flushing the bufferpublic void setQuiescentLimit(long timeoutMS) throws StreamBaseException
timeoutMS
- - If no heart beat is received from the server in
timeoutMS milliseconds, the server is considered unavailable.
This only has effect if the server is configured to emit client heart beats.
This is not a real-time detection mechanism, so generous timeout limits
should be used. 0 disables quiescent server detection.StreamBaseException
- thrown if the request limit is not at least
two times the servers configured client heart beat rate.public Schema getSchemaByHash(byte[] hash) throws StreamBaseException
hash
- a byte array that contains a hash valueStreamBaseException
- thrown on network or other errorspublic boolean hasSchema(java.lang.String schemaName)
schemaName
- the name of the Schema to look upStreamBaseClient.getSchemaByName(String)
public Schema getSchemaByName(java.lang.String name) throws StreamBaseException
StreamBaseClient.getStreamProperties(String)
.name
- the name of the Schema to lookupStreamBaseException
- thrown on network or other errorspublic boolean hasStreamProperties(java.lang.String streamName)
streamName
- the stream name to look forStreamBaseClient.getStreamProperties(String)
public StreamProperties getStreamProperties(java.lang.String streamName, CaptureTransformStrategy strategy) throws StreamBaseException
streamName
- the name of a stream, that may be fully qualified (for example, mycontainer.MyInputSchema
).
When unqualified, the container from the URI the connection was established with is used, otherwise
StreamBaseURI.DEFAULT_CONTAINER
is used.StreamBaseException
- thrown on network or other errorspublic StreamProperties getStreamProperties(java.lang.String streamName) throws StreamBaseException
streamName
- the name of a stream, that may be fully qualified (for example, mycontainer.MyInputSchema
).
When unqualified, the container from the URI the connection was established with is used, otherwise
StreamBaseURI.DEFAULT_CONTAINER
is used.StreamBaseException
- thrown on network or other errorsprotected static java.lang.String assureNameStartsWithContainer(StreamProperties base, java.lang.String logicalName)
public StreamProperties getStreamPropertiesByHash(java.lang.String hashHexString) throws StreamBaseException
hashHexString
- The Hash as a HexStringStreamBaseException
- thrown on network or other errorspublic StreamProperties getStreamPropertiesByHash(byte[] hash) throws StreamBaseException
hash
- The Hash to lookupStreamBaseException
- thrown on network or other errorspublic java.util.Set<StreamProperties> getAllStreamProperties(EntityType type, CaptureTransformStrategy strategy) throws StreamBaseException
type
- Can be STREAM, INPUT_STREAMS, or OUTPUT_STREAMSstrategy
- the CaptureTransformStrategy to use. Can be FLATTEN or NESTStreamBaseException
- thrown on network or other errorspublic java.util.Set<StreamProperties> getAllStreamProperties(EntityType type) throws StreamBaseException
type
- Can be STREAM, INPUT_STREAMS, or OUTPUT_STREAMSStreamBaseException
- thrown on network or other errorspublic boolean hasStream(java.lang.String streamName)
streamName
- StreamBaseClient.getSchemaForStream(String)
public Schema getSchemaForStream(java.lang.String streamName) throws StreamBaseException
streamName
- the name of a stream, that may be fully qualified (for example, mycontainer.MyInputSchema
).
When unqualified, the container from the URI the connection was established with is used, otherwise
StreamBaseURI.DEFAULT_CONTAINER
is used.StreamBaseException
- if the stream is not found, or on network errorspublic static java.lang.String getVersion()
Version.INFO_LINE
public java.lang.String[] listEntities(EntityType entityType, CaptureTransformStrategy strategy) throws StreamBaseException
StreamBaseClient.listEntities(EntityType, int)
with StreamBaseClient.ListEntityFlags.NO_FLAGS
as the second argument. Note: if the container you are connected to
does not exist when issuing this request, and this call is made without the
StreamBaseClient.ListEntityFlags.ALL_CONTAINERS
flag, the request will fail.entityType
- the entity type that the looking is being done forstrategy
- the strategy to use for capture fieldsStreamBaseException
- thrown on network or other errorsStreamBaseClient.listEntities(String, int)
,
EntityType
,
StreamBaseClient.ListEntityFlags
public java.lang.String[] listEntities(EntityType entityType) throws StreamBaseException
StreamBaseClient.listEntities(EntityType, int)
with StreamBaseClient.ListEntityFlags.NO_FLAGS
as the second argument. Note: if the container you are connected to
does not exist when issuing this request, and this call is made without the
StreamBaseClient.ListEntityFlags.ALL_CONTAINERS
flag, the request will fail.entityType
- the entity type that the looking is being done forStreamBaseException
- thrown on network or other errorsStreamBaseClient.listEntities(String, int)
,
EntityType
,
StreamBaseClient.ListEntityFlags
public java.lang.String[] listEntities(EntityType entityType, int flags, CaptureTransformStrategy strategy) throws StreamBaseException
Examples are as follows:
// list streams on container specified in StreamBaseURI given to StreamBaseClient
client.listEntities(EntityType.STREAM, StreamBaseClient.ListEntityFlags.NO_FLAGS)
// list operators on ALL containers
client.listEntities(EntityType.OPERATOR, StreamBaseClient.ListEntityFlags.ALL_CONTAINERS)
Note: if the container you are connected to
does not exist when issuing this request, and this call is made without the
StreamBaseClient.ListEntityFlags.ALL_CONTAINERS
flag, the request will fail.
entityType
- the entity type that the looking is being done forflags
- a combination of flags from StreamBaseClient.ListEntityFlags
strategy
- the strategy to use for capture fieldsStreamBaseException
- thrown on network or other errorsEntityType
,
StreamBaseClient.ListEntityFlags
public java.lang.String[] listEntities(EntityType entityType, int flags) throws StreamBaseException
Examples are as follows:
// list streams on container specified in StreamBaseURI given to StreamBaseClient
client.listEntities(EntityType.STREAM, StreamBaseClient.ListEntityFlags.NO_FLAGS)
// list operators on ALL containers
client.listEntities(EntityType.OPERATOR, StreamBaseClient.ListEntityFlags.ALL_CONTAINERS)
Note: if the container you are connected to
does not exist when issuing this request, and this call is made without the
StreamBaseClient.ListEntityFlags.ALL_CONTAINERS
flag, the request will fail.
entityType
- the entity type that the looking is being done forflags
- a combination of flags from StreamBaseClient.ListEntityFlags
StreamBaseException
- thrown on network or other errorsEntityType
,
StreamBaseClient.ListEntityFlags
public java.lang.String[] listEntities(java.lang.String entityPath, int flags, CaptureTransformStrategy strategy) throws StreamBaseException
EntityType
class
Examples are as follows:
// list streams on container specified in StreamBaseURI given to StreamBaseClient
client.listEntities("streams", StreamBaseClient.ListEntityFlags.NO_FLAGS)
// list streams on container "other"
client.listEntities("other.streams", StreamBaseClient.ListEntityFlags.NO_FLAGS)
// list streams on ALL containers
client.listEntities("streams", StreamBaseClient.ListEntityFlags.ALL_CONTAINERS)
Note: if the container you are connected to
does not exist when issuing this request, and this call is made without the
StreamBaseClient.ListEntityFlags.ALL_CONTAINERS
flag, the request will fail.
entityPath
- the entity type to do the lookup. Use
container.entity-type to resolve across containersflags
- a combination of flags from StreamBaseClient.ListEntityFlags
strategy
- the strategy to use for capture fieldsStreamBaseException
- thrown on network or other errorsEntityType
,
StreamBaseClient.ListEntityFlags
public java.lang.String[] listEntities(java.lang.String entityPath, int flags) throws StreamBaseException
EntityType
class
Examples are as follows:
// list streams on container specified in StreamBaseURI given to StreamBaseClient
client.listEntities("streams", StreamBaseClient.ListEntityFlags.NO_FLAGS)
// list streams on container "other"
client.listEntities("other.streams", StreamBaseClient.ListEntityFlags.NO_FLAGS)
// list streams on ALL containers
client.listEntities("streams", StreamBaseClient.ListEntityFlags.ALL_CONTAINERS)
Note: if the container you are connected to
does not exist when issuing this request, and this call is made without the
StreamBaseClient.ListEntityFlags.ALL_CONTAINERS
flag, the request will fail.
entityPath
- the entity type to do the lookup. Use
container.entity-type to resolve across containersflags
- a combination of flags from StreamBaseClient.ListEntityFlags
StreamBaseException
- thrown on network or other errorsEntityType
,
StreamBaseClient.ListEntityFlags
public StreamProperties subscribe(java.lang.String streamname) throws StreamBaseException
streamname
- the stream to subscribe toStreamBaseException
- thrown on errorpublic StreamProperties subscribe(java.lang.String streamName, CaptureTransformStrategy strategy) throws StreamBaseException
streamName
- the name of a stream, that may be fully qualified (for example, mycontainer.MyInputSchema
).
When unqualified, the container from the URI the connection was established with is used, otherwise
StreamBaseURI.DEFAULT_CONTAINER
is used.StreamBaseException
- thrown on errorpublic StreamProperties subscribe(StreamProperties props) throws StreamBaseException
props
- the stream to subscribe toStreamBaseException
- thrown on errorpublic StreamProperties subscribe(java.lang.String streamname, java.lang.String logicalstream, java.lang.String predicate) throws StreamBaseException
streamname
- the stream to subscribe tologicalstream
- the name of the logical stream to associate with this predicate (if empty or null, defaults to streamname)predicate
- a predicate to apply to subset the streamStreamBaseException
- thrown on error, including empty or null streamname or predicatepublic StreamProperties subscribe(java.lang.String streamName, CaptureTransformStrategy strategy, java.lang.String logicalstream, java.lang.String predicate) throws StreamBaseException
streamName
- the name of a stream, that may be fully qualified (for example, mycontainer.MyInputSchema
).
When unqualified, the container from the URI the connection was established with is used, otherwise
StreamBaseURI.DEFAULT_CONTAINER
is used.strategy
- the CaptureTransformStrategy to use if there are capture fields in the streamlogicalstream
- the name of the logical stream to associate with this predicate (if empty or null, defaults to streamname)predicate
- a predicate to apply to subset the streamStreamBaseException
- thrown on error, including empty or null streamname or predicatepublic StreamProperties subscribe(StreamProperties props, java.lang.String logicalstream, java.lang.String predicate) throws StreamBaseException
props
- the stream to subscribe tologicalstream
- the name of the logical stream to associate with this predicate (if empty or null, defaults to streamname)predicate
- a predicate to apply to subset the streamStreamBaseException
- thrown on error, including empty or null streamname or predicatepublic StreamProperties resubscribe(java.lang.String streamname, java.lang.String logicalstream, java.lang.String predicate) throws StreamBaseException
streamname
- the stream to subscribe tologicalstream
- the name of the logical stream to associate with this predicatepredicate
- a predicate to apply to subset the streamStreamBaseException
- thrown on errorpublic StreamProperties resubscribe(StreamProperties props, java.lang.String logicalstream, java.lang.String predicate) throws StreamBaseException
props
- the stream to subscribe tologicalstream
- the name of the logical stream to associate with this predicatepredicate
- a predicate to apply to subset the streamStreamBaseException
- thrown on errorpublic StreamProperties[] typecheck(java.lang.String application) throws StreamBaseException
application
- contents of an application. Text sbapp or ssql.StreamBaseException
- on network or typecheck errorpublic StreamProperties[] typecheck(java.lang.String application, boolean full) throws StreamBaseException
application
- contents of an application. Text sbapp or ssql.full
- do a full typecheckStreamBaseException
- on network or typecheck errorpublic void unsubscribe(java.lang.String logicalStreamName) throws StreamBaseException
logicalStreamName
- the name of the stream to unsubscribe from, which is logical streamname on filtered subscribeStreamBaseException
- thrown on network or other errorspublic void unsubscribe(StreamProperties logicalProps) throws StreamBaseException
logicalProps
- the StreamProperties for this logical subscriptionStreamBaseException
- thrown on network or other errorsprotected void unsubscribeInternal(StreamProperties logicalProps) throws StreamBaseException
StreamBaseException
public byte[] getConnectionID()
public java.util.Set<java.lang.String> getSubscribedStreamNames()
public boolean isSubscribed(StreamProperties stream)
stream
- the stream we want to checkprotected static void checkValidStreamname(java.lang.String streamname) throws StreamBaseException
StreamBaseException
public java.lang.Object getDynamicVariable(java.lang.String dynamicVariablePath) throws StreamBaseException
dynamicVariablePath
- the path to the dynamic variable, expressed as the path to the module containing the dynamic variable,
and then a dot, and then the name of the dynamic variable.Tuple.getField(String)
StreamBaseException
- if the dynamic variable path does not exist or an error occurs while communicating with the serverpublic Tuple getDynamicVariables(java.lang.String modulePath) throws StreamBaseException
modulePath
- the module to get the dynamic variables ofStreamBaseException
- if the module does not exist, or an error occurs while communicating with the serverpublic void setDynamicVariable(java.lang.String dynvarPath, java.lang.Object value) throws StreamBaseException
dynvarPath
- the path to the dynamic variable to set. This consists of the dotted path to the module that contains
the dynamic variable, followed by a dot, followed by the name of the dynamic variable.value
- the value to set the dynamic variable to. It should be the same type that StreamBaseClient.getDynamicVariable(String)
would
return for this dynamic variable.StreamBaseException
- if the dynamic variable does not exist, or the value is not appropriate for setting the dynamic
variablepublic long getTupleEnqueueCount()
public long getTupleDequeueCount()
public int getEnqueueBufferSize()
public java.util.List<Tuple> readTable(java.lang.String tablePath, int rowLimit) throws StreamBaseException
tablePath
- Path to the table. A fully qualified path is a dot-separated string optionally starting
with a container name (when omitted, the container specified by this client's URI is used), followed by
zero or more module reference names, and finally the table or window name. For example,
default.ModuleRef1.DataTable
is a valid fully qualified path, where default.
may be omitted when this client is connected to the default container.rowLimit
- Limit on number of rows to return, or -1 for all rows.StreamBaseException
- If the connection is not valid or the server cannot be contacted, or the table does not exist, or the predicate is faulty.public java.util.List<Tuple> readTable(java.lang.String tablePath, int rowLimit, java.lang.String predicate) throws StreamBaseException
tablePath
- Path to the table. A fully qualified path is a dot-separated string optionally starting
with a container name (when omitted, the container specified by this client's URI is used), followed by
zero or more module reference names, and finally the table or window name. For example,
default.ModuleRef1.DataTable
is a valid fully qualified path, where default.
may be omitted when this client is connected to the default container.rowLimit
- Limit on number of rows to return, or -1 for all rows.predicate
- A predicate to apply to the rows to select those for retrieval. A null predicate returns all rows.StreamBaseException
- If the connection is not valid or the server cannot be contacted, or the table does not exist, or the predicate is faulty.public void addConnectionStatusCallback(ConnectionStatusCallback callback)
callback
- a class that implements the ConnectionStatusCallback interfacepublic void removeConnectionStatusCallback(ConnectionStatusCallback callback)
callback
- an instance of ConnectionStatusCallbackprotected void setConnectionStatus(ConnectionStatus status, java.lang.String additionalInfo)
public ConnectionStatus getConnectionStatus()
public java.lang.String getConnectionError()
protected boolean haModeOn()
public ClientSettings getSettings()
public java.lang.String[] status() throws StreamBaseException
StreamBaseException
- thrown on network and other errorspublic java.lang.String[] status(boolean verbose) throws StreamBaseException
verbose
- return a verbose statusStreamBaseException
- thrown on network and other errorspublic java.lang.String[] operatorStatus(java.lang.String containerName) throws StreamBaseException
containerName
- the name of the containerStreamBaseException
public StreamBaseURI getURI()
public java.util.List<StreamBaseURI> getURIs()