Constructor
new StreamingQueryManager()
- Since:
- EclairJS 0.7 Spark 2.0.0
- Source:
Methods
active() → {Array.<module:eclairjs/sql/streaming.StreamingQuery>}
Returns a list of active queries associated with this SQLContext
- Since:
- EclairJS 0.7 Spark 2.0.0
- Source:
Returns:
- Type
- Array.<module:eclairjs/sql/streaming.StreamingQuery>
addListener(queryStartedCallback, queryProcessCallback, queryTerminateCallback, openFunctionBindArgsopt, processFunctionBindArgsopt, closeFunctionBindArgsopt) → {module:eclairjs/sql/streaming.StreamingQueryListener}
Register to receive callbacks for life cycle events of
module:eclairjs/sql/streaming.StreamingQuery.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
queryStartedCallback |
module:eclairjs/sql/streaming.StreamingQueryManager~queryStartedCallback | ||
queryProcessCallback |
module:eclairjs/sql/streaming.StreamingQueryManager~queryProcessCallback | ||
queryTerminateCallback |
module:eclairjs/sql/streaming.StreamingQueryManager~queryTerminateCallback | ||
openFunctionBindArgs |
Array.<object> |
<optional> |
|
processFunctionBindArgs |
Array.<object> |
<optional> |
|
closeFunctionBindArgs |
Array.<object> |
<optional> |
- Since:
- EclairJS 0.5 Spark 2.0.0
- Source:
Returns:
Example
var listener = queryManger.addListener(
function(queryStartedInfo){
//print("queryStartedEvent");
result = queryStartedInfo.name();
},
function(queryProgressInfo){
//print("queryProgressEvent" + queryProgressInfo.name());
},
function(queryTerminatedInfo){
print("queryTerminatedEvent " + queryTerminatedInfo.name());
}
);
awaitAnyTermination(timeoutMsopt) → {boolean}
Wait until any of the queries on the associated SQLContext has terminated since the
creation of the context, or since `resetTerminated()` was called. Returns whether any query
has terminated or not (multiple may have terminated). If any query has terminated with an
exception, then the exception will be thrown.
If a query has terminated, then subsequent calls to `awaitAnyTermination()` will either
return `true` immediately (if the query was terminated by `query.stop()`),
or throw the exception immediately (if the query was terminated with exception). Use
`resetTerminated()` to clear past terminations and wait for new terminations.
In the case where multiple queries have terminated since `resetTermination()` was called,
if any query has terminated with exception, then `awaitAnyTermination()` will
throw any of the exception. For correctly documenting exceptions across multiple queries,
users need to stop all of them after any of them terminates with exception, and then check the
`query.exception()` for each query.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
timeoutMs |
number |
<optional> |
- Since:
- EclairJS 0.7 Spark 2.0.0
- Source:
Throws:
StreamingQueryException, if any query has terminated with an exception
Returns:
- Type
- boolean
get(id) → {module:eclairjs/sql/streaming.StreamingQuery}
Returns the query if there is an active query with the given id, or null.
Parameters:
Name | Type | Description |
---|---|---|
id |
number |
- Since:
- EclairJS 0.7 Spark 2.0.0
- Source:
Returns:
removeListener(listener)
Deregister a module:eclairjs/sql/streaming.StreamingQueryListener.
Parameters:
Name | Type | Description |
---|---|---|
listener |
module:eclairjs/sql/streaming.StreamingQueryListener |
- Since:
- EclairJS 0.7 Spark 2.0.0
- Source:
resetTerminated()
Forget about past terminated queries so that `awaitAnyTermination()` can be used again to
wait for new terminations.
- Since:
- EclairJS 0.7 Spark 2.0.0
- Source:
Type Definitions
queryProcessCallback(queryInfo, bindArgsopt)
This callback called when query processing.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
queryInfo |
module:eclairjs/sql/streaming.StreamingQueryInfo | ||
bindArgs |
Array.<object> |
<optional> |
queryStartedCallback(queryInfo, bindArgsopt)
This callback called when query starts.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
queryInfo |
module:eclairjs/sql/streaming.StreamingQueryInfo | ||
bindArgs |
Array.<object> |
<optional> |
queryTerminateCallback(queryInfo, bindArgsopt)
This callback called when query terminate.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
queryInfo |
module:eclairjs/sql/streaming.StreamingQueryInfo | ||
bindArgs |
Array.<object> |
<optional> |