WSO2 CEP Multiple rows in resultset

ぃ、小莉子 提交于 2019-12-11 10:09:17

问题


I wanted to know if the WSO2 CEP/Siddhi query supports returning multiple rows if yes how data from those rows can be mapped to the output XML ? e.g. my event stream has a field statusCode which can have values A/B/C I wanted to write a query which gives me the count by status type for past 5 mins e.g A-10,B-5,C-2.. in the current query i used group by statusCode to get the count of status

 MyQuery- ...insert into TestStream statusCode, count(statusCode) as count group by  statusCode

and my output XML is something like

<statusSmry>
  <status>{statusCode}</status>
  <count>{count}</status>
</statusSmry>

the output i receive is something like

   <statusSmry>
      <status>A</status>
       <count>10</status>
    </statusSmry>
   .....
    <statusSmry>
      <status>B</status>
      <count>5</status>
    </statusSmry>
    ....
    <statusSmry>
      <status>C</status>
      <count>2</status>
    </statusSmry>

Is it possible to get results of query in a single XML ? i.e. in above case counts for A,B,C in a single XML ?

Thanks Rajiv


回答1:


What you asked is not possible in Siddhi.

This is because whenever there is an input event the total count will be updated, at the same time an output for the corresponding updated group need to be triggered to notify the subscribers. Since this is a realtime process Siddhi cannot accumulate all the events and output as one event/XML. If in any case its going to accumulate the events then there will be a problem for how long it's going to accumulate for, 1sec or 1day?, and in what format the output need to be sent, therefore currently it's (WSO2 CEP 2.0.1) not supporting accumulation.

If you need this feature then you have to send the output of CEP to an ESB and run some kind of an aggregation process.

Suho



来源:https://stackoverflow.com/questions/14152289/wso2-cep-multiple-rows-in-resultset

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!