Вопрос

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

Это было полезно?

Решение

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top