DStream::haBuffer

Syntax

DStream::haBuffer(name, raftGroup, cacheLimit, [retentionMinutes=1440])

Parameters

name is a string representing the name of the Orca stream table. You can provide either the fully qualified name (FQN), such as "trading.orca_table.factors", or just the table name, like "factors". If only the name is given, the system will automatically complete it using the current catalog.

raftGroup can be either an integer greater than 1 or a string.

  • Integer: represents the raft group ID.
  • String: represents a raft group alias, which must be preconfigured via streamingRaftGroupAliases.

Details

Creates a high-availability stream table to store intermediate results in stream processing.

For more information on table persistence, refer to the haStreamTable documentation.

Return value: A DStream object.

Examples

login(`admin,`123456)

if (!existsCatalog("orca")) {
	createCatalog("orca")
}
go
use catalog orca

g = createStreamGraph("indicators")

g.source("trade", `time`symbol`price`volume, [DATETIME,SYMBOL,DOUBLE,LONG])
    .timeSeriesEngine(windowSize=60, step=60, metrics=[<first(price) as open>, <max(price) as high>, <min(price) as low>, <last(price) as close>, <sum(volume) as volume>], timeColumn=`time, keyColumn=`symbol)
    .haBuffer(name="ha_Table", raftGroup=3, cacheLimit=5)