我正在研究流处理器 4.3.0。我遇到了一种情况,我使用 siddhiapp 将一些数据馈送到 rdbms 表中。使用 siddiapp,我在 RDBMS 表中输入数据,如下所示
现在,我正在使用另一个 SiddhiApp 来检索数据,但我想尝试以如下方式获取数据
由于公共列被缩小以进入一行,并且现在对具有计数的列求和以获得所有计数的最终总和。
有人可以指导我如何在这里进行。
提前致谢
这是获得总和的应用程序
@App:name("IncomingStream3")
@App:description("Description of the plan")
-- Please refer to https://docs.wso2.com/display/SP400/Quick+Start+Guide on getting started with SP editor.
--@store(type = 'rdbms', datasource = 'APIM_ANALYTICS_DB')
--@purge(enable='false', interval='60 min', @retentionPeriod(sec='1 day', min='72 hours', hours='90 days', days='1 year', months='2 years', years='3 years'))
define stream TempStatsStream (AGG_TIMESTAMP long, AGG_EVENT_TIMESTAMP long, apiName string, apiVersion string, apiResourcePath string,apiCreator string,username string, applicationConsumerKey string, AGG_LAST_EVENT_TIMESTAMP long, applicationName string, dateTime string, AGG_COUNT int);
define aggregation StatsToCal
from TempStatsStream
select apiName, apiVersion, apiResourcePath, apiCreator, username, applicationName,
applicationConsumerKey, SUM (AGG_COUNT) as totalRequestCount, dateTime
group by apiName, apiVersion, apiResourcePath, username, applicationConsumerKey
aggregate by dateTime every days;
我在这里所做的唯一更改不是从数据库表中获取值,而是将其视为流(因为聚合只能针对流进行,我想)。