|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectstreamcruncher.api.StreamCruncher
public final class StreamCruncher
The main class provided by the Kernel to - register/unregister Event Streams, Queries, hooks etc. It also provides methods to start and stop the Kernel.
| Constructor Summary | |
|---|---|
StreamCruncher()
Any number of these instances can be created. |
|
| Method Summary | |
|---|---|
void |
clearStartupShutdownHook()
Removes the Listener from the Kernel. |
java.sql.Connection |
createConnection()
|
InputSession |
createInputSession(java.lang.String name)
Creates a helper object for the Input Event Stream. |
OutputSession |
createOutputSession(java.lang.String queryName)
Creates a helper object for the Output Event Stream. |
java.lang.String |
getDBSchema()
|
QueryConfig |
getQueryConfig(java.lang.String queryName)
Each Query has a unique config-object and this method returns a handle to the same. |
ResultSetCacheConfig |
getResultSetCacheConfig(java.lang.String cachedSql)
|
java.util.Collection<java.lang.String> |
getResultSetCacheConfigKeys()
|
StartupShutdownHook |
getStartupShutdownHook()
|
long |
getTimeBiasMsecs()
|
void |
keepRunning()
Once the Kernel has started, this method can be invoked, where the invoking Thread blocks and waits for the stop-instruction to be typed at the System Console. |
ParsedQuery |
parseQuery(ParserParameters parserParameters)
The "Running Query" that will execute on the Event Stream has to be parsed by the Kernel first. |
void |
registerAggregator(AbstractAggregatorHelper helper)
Registers an Aggregator function. |
void |
registerInStream(java.lang.String name,
RowSpec rowSpec)
Register an Input Event Stream as described by the RowSpec and
default Block size of 1024. |
void |
registerInStream(java.lang.String name,
RowSpec rowSpec,
int blockSize)
Register an Input Event Stream as described by the RowSpec. |
void |
registerProvider(java.lang.String providerName,
java.lang.Class<? extends Provider> providerClass)
Registers a Provider. |
void |
registerQuery(ParsedQuery parsedQuery)
Registers the Query that was parsed using parseQuery(ParserParameters). |
void |
setStartupShutdownHook(StartupShutdownHook hook)
Sets the lifecycle Listener. |
void |
setTimeBiasMsecs(long timeBiasMsecs)
Forces the Kernel to add the number provided to the time it obtains from the System clock. |
void |
start(java.lang.String configFilePath)
Starts the Kernel. |
void |
stop()
This is an alternative way of stopping the Kernel (also see keepRunning()) |
void |
unregisterAggregator(java.lang.String functionName)
An Aggregator must be unregistered only after all the Queries that use it have been unregistered. |
void |
unregisterInStream(java.lang.String name)
Unregisters the Input Event Stream. |
void |
unregisterProvider(java.lang.String providerName)
A Provider must be unregistered only after all the Queries that use it have been unregistered. |
void |
unregisterQuery(java.lang.String name)
Stops and unregisters the Query that is running on the Kernel. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StreamCruncher()
| Method Detail |
|---|
public void setStartupShutdownHook(StartupShutdownHook hook)
start(String) method if the intention is to listen to Startup
events and/or before invoking the stop() or before the
Kernel is issued a stop command via keepRunning() if the
intention is to listen to Shutdown events.
hook - public void clearStartupShutdownHook()
public StartupShutdownHook getStartupShutdownHook()
public void start(java.lang.String configFilePath)
throws StreamCruncherException
The Kernel must be started first using this method, before invoking any method on any of the API Classes.
configFilePath - The path, including the name of the Kernel configuration file.
StreamCruncherException
public void keepRunning()
throws StreamCruncherException
StreamCruncherException
public void stop()
throws StreamCruncherException
keepRunning())
StreamCruncherException
public void registerInStream(java.lang.String name,
RowSpec rowSpec,
int blockSize)
throws StreamCruncherException
RowSpec.
name - rowSpec - blockSize - This number is used by the Kernel to allocate blocks in memory
to accomodate the incoming Events. Input Streams with very
high rates of arrivals must use larger numbers (multiples of
1024).
StreamCruncherException
public void registerInStream(java.lang.String name,
RowSpec rowSpec)
throws StreamCruncherException
RowSpec and
default Block size of 1024.
name - rowSpec -
StreamCruncherExceptionregisterInStream(String, RowSpec, int)
public void unregisterInStream(java.lang.String name)
throws StreamCruncherException
name -
StreamCruncherException
public ParsedQuery parseQuery(ParserParameters parserParameters)
throws StreamCruncherException
parserParameters -
StreamCruncherException
public void registerQuery(ParsedQuery parsedQuery)
throws StreamCruncherException
parseQuery(ParserParameters). The Query execution will start
after this registration (based on the configurations provided using the
QueryConfig).
parsedQuery -
StreamCruncherExceptionpublic QueryConfig getQueryConfig(java.lang.String queryName)
ParsedQuery.getQueryConfig() method. This object must be
retrieved (if needed) afresh after every Kernel restart.
queryName -
null if there is no Query that has been registered
with this name.public void unregisterQuery(java.lang.String name)
name - As provided in ParserParameters.getQueryName().
public java.sql.Connection createConnection()
throws java.sql.SQLException
java.sql.SQLExceptionpublic java.lang.String getDBSchema()
public java.util.Collection<java.lang.String> getResultSetCacheConfigKeys()
public ResultSetCacheConfig getResultSetCacheConfig(java.lang.String cachedSql)
cachedSql -
null. Since there could be
multiple Queries that use the same SQL as a Sub-Query, the Kernel
maintains only one cache that will be shared by all the
referrers.
public InputSession createInputSession(java.lang.String name)
throws StreamCruncherException
name -
StreamCruncherException
public OutputSession createOutputSession(java.lang.String queryName)
throws StreamCruncherException
queryName -
StreamCruncherException
public void registerAggregator(AbstractAggregatorHelper helper)
throws StreamCruncherException
helper -
StreamCruncherExceptionpublic void unregisterAggregator(java.lang.String functionName)
functionName - As provided in
AbstractAggregatorHelper.getFunctionName()
public void registerProvider(java.lang.String providerName,
java.lang.Class<? extends Provider> providerClass)
throws StreamCruncherException
providerName - providerClass -
StreamCruncherExceptionpublic void unregisterProvider(java.lang.String providerName)
providerName - As provided in registerProvider(String, Class)public void setTimeBiasMsecs(long timeBiasMsecs)
timeBiasMsecs - Bias in milliseconds (+ve or -ve).public long getTimeBiasMsecs()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||