简体   繁体   English

WSO2 DAS SiddhiQL:动态事件表/持久事件流

[英]WSO2 DAS SiddhiQL : Dynamic event table / persist event stream

I would like to know if WSO2 Data Analytics Server allows to define a dynamic events tables or dynamic streams. 我想知道WSO2 Data Analytics Server是否允许定义动态事件表或动态流。 For example, imagine one event represent a car, and in this event, an attribute is the 'brand' of the car (Ford, Mercedes, Audi ...). 例如,假设一个事件代表一辆汽车,并且在此事件中,一个属性是汽车的“品牌” (福特,奔驰,奥迪...)。

And I would like to add a column each time there is a new different brand. 我想在每次有新的不同品牌时添加一列。 So my table would look like this : 所以我的桌子看起来像这样:

在此处输入图片说明

And thus, if I receive an event with the brand 'Toyota', it would add a column to my table which would look like this: 因此,如果我收到一个品牌为“ Toyota”的事件,它将在表中添加一个如下所示的列:

在此处输入图片说明

Considering that I don't know in advance the number of different brands I will receive, I need this to be dynamic. 考虑到我不知道会收到多少个不同的品牌,我需要保持动态。

Dynamically changing the schema of an event table is not possible. 无法动态更改事件表的架构。 This is because the schema of the event table is defined when the Siddhi execution plan is deployed. 这是因为在部署Siddhi执行计划时定义了事件表的架构。 Once it is deployed, the schema cannot be changed. 部署后,将无法更改架构。

On the other hand, it looks like what you need here is not an event table. 另一方面,看起来您这里需要的不是事件表。

Perhaps, what you need to do is to update the schema of a table (an RDBMS table) when a certain event happens (for example, when a car event arrives with a new brand). 也许,您需要做的是在特定事件发生时(例如,当汽车事件以新品牌到达时)更新表(RDBMS表)的架构。 Do you use this updated table in your Siddhi execution plan? 您是否在Siddhi执行计划中使用了此更新的表? If you do not use it, then you do not need an event table. 如果不使用它,则不需要事件表。 Please correct me if I have misunderstood your requirement. 如果我误解了您的要求,请指正。

If your requirement is to update the schema of a table when a certain event happens, then you might need to write a custom event publisher to do that. 如果您的要求是在发生特定事件时更新表的架构,则可能需要编写自定义事件发布者来执行此操作。 If so, please refer the document on the same: Building Custom Event Publishers . 如果是这样,请参考同一文档: 建立自定义事件发布者

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM