0

I'm just starting testing WSO2 CEP. I'm using version 3.1.0.

I've done a first successful test with a single attribute event and a very simple query. But no, I've tried to make the test a bit more realistic, and added more attributes to my events, and a more complex query. The Execution Plan XML file copy is at the end of my message.

I don't understand why the "insert into so" statement in the query produces an error message, stating that the output stream is defined twice. Indeed, the stream is exported.

When I delete the "insert into so", the plan is deployed, but no event ever gets out...

Any idea of what I don't do as expected ?

Thanks for your help.

Regards.

The XML file :

<?xml version="1.0" encoding="UTF-8"?>
<executionPlan name="Fifi_Test_Execution_Plan_1" statistics="enable"
  trace="enable" xmlns="http://wso2.org/carbon/eventprocessor">
  <description/>
  <siddhiConfiguration>
    <property name="siddhi.persistence.snapshot.time.interval.minutes">0</property>
    <property name="siddhi.enable.distributed.processing">false</property>
  </siddhiConfiguration>
  <importedStreams>
    <stream as="si" name="Fifi_Test_Event_Stream_1" version="1.0.0"/>
  </importedStreams>
  <queryExpressions><![CDATA[

from si#window.timeBatch(10 sec)
select code, count(code) as number, sum(value) as total
group by code
insert into so;

]]></queryExpressions>
  <exportedStreams>
    <stream name="Fifi_Test_Event_Stream_2" valueOf="so" version="1.0.0"/>
  </exportedStreams>
</executionPlan>

The error message :

Exception: Invalid query specified, Stream so is already defined as StreamDefinition{streamId='so', attributeList=[Attribute{name='code', type=STRING}, Attribute{name='number', type=LONG}, Attribute{name='total', type=INT}]}, hence cannot define StreamDefinition{streamId='so', attributeList=[Attribute{name='code', type=STRING}, Attribute{name='number', type=LONG}, Attribute{name='total', type=LONG}]}

1 Answers1

0

The reason for above issue is simply expressed through the exception. Below is the more detailed reason for the issue..

I think, initially you have created an execution plan which exports the events to stream "Fifi_Test_Event_Stream_2". This stream contains the below attributes,

attributeList=[Attribute{name='code', type=STRING}, Attribute{name='number', type=LONG}, Attribute{name='total', type=INT}]

But, now you have written an another query to calculate the sum, after calculating the sum you have exporting those events to same stream "Fifi_Test_Event_Stream_2" (Stream "so" is just alias to the stream "Fifi_Test_Event_Stream_2").

Since you are calculating sum, exported stream contains attributes in below type,

[Attribute{name='code', type=STRING}, Attribute{name='number', type=LONG}, Attribute{name='total', type=LONG}]

Then, you cannot forward those events to stream "Fifi_Test_Event_Stream_2"..

Mohanadarshan
  • 830
  • 5
  • 5
  • Thanks for the explanation. But I don't understand what I must do to "unexport" the previous stream, export the new one, and use the resulting alias to send my output events (insert into so)... Thanks again. – Ephéméris Lappis Aug 20 '14 at 16:16
  • Sorry for coming back again ! I've just changed the total attribute type from int to long in my stream, and reactivated the execution plan, and it works ! So, thanks for your help... Regards. – Ephéméris Lappis Aug 20 '14 at 16:23