0

Following link provide a WSO2 CEP sample

https://docs.wso2.com/display/CEP310/Getting+Started+with+CEP

I sequentially proceed the document and have no problems.

But i have a question about following Siddhi Language

define table pizza_deliveries (deliveredTime long, order_id string);

from deliveryStream
select time, orderNo
insert into pizza_deliveries;

from orderStream#window.time(30 seconds)
insert into overdueDeliveries for expired-events;

from overdueDeliveries as overdueStream unidirectional join pizza_deliveries
on pizza_deliveries.order_id == overdueStream.orderNo
select count(overdueStream.orderNo) as sumOrderId, overdueStream.customerName
insert into deliveredOrders;

In this execution plan, pizza_deliveries are defined as table. orderStream, deliveryStream, deliveredOrders are defined as document.

I can't find where and when "overdueDeliveries" is defined. But, it's working..

My question is

when or where overdueDeliveries is defined? automatically generated?

And...

Is overdueDeliveries stream or table?

Community
  • 1
  • 1
Julian Lee
  • 79
  • 1
  • 8

1 Answers1

0

overdueDeliveries is a stream and it's defined implicitly by Siddhi engine.

If you look at this query:

from orderStream#window.time(30 seconds)
insert into overdueDeliveries for expired-events;

in this query all attributes coming through the orderStream are added to the overdueDeliveries stream and Siddhi engine defines the stream with them.

similarly if you write a query like following:

from orderStream
select orderNo
insert into orderNumbersStream;

in this case the Siddhi engine will define a stream named orderNumbersStream with the attribute 'orderNo' only since it's explicitly selected. if there's no select statement, by default, all attributes are added to the stream.

Also, orderStream, deliveryStream and deliveredOrders are streams. In siddhi, events flow through 'streams' and you can imagine it as a way to pass events from one query to another (one or more).

Regarding tables - When you define a table, you have to explicitly define it using a define table query as given in this execution plan.

Rajeev Sampath
  • 2,739
  • 1
  • 16
  • 19