CEP列表作为单个项目(对托管对象进行迭代) [英] CEP List as single items (iterate over managed obejects)

查看:70
本文介绍了CEP列表作为单个项目(对托管对象进行迭代)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在CEP中,我可以将受管理对象作为列表获取,例如使用功能"... ManagedObjectByType".获取列表后,我使用AllOf函数来过滤列表.现在,我想将列表中的每个Mangaged Object放入一个新的流中({A,B,C}-> A,B,C),以便将它们彼此分开以在其中生成警报下一阶段.不幸的是,我不知道如何从列表中产生单个事件(被管理对象).有人可以帮忙吗?

in CEP, I can get managed objects as a list, for example with the function "...ManagedObjectByType". After getting the list, I use the AllOf function to filter the list. Now, I would like to put every single Mangaged Object from the list into a new stream ({A,B,C} -> A,B,C), so they are seperated from each other in order to generate for example alarms in the next stage. Unfortunately, I have no clue how I can produce single events (Managed Objects) from a List. Can someone help?

最好, 尼科

推荐答案

您可以执行以下操作:

create schema Device as ManagedObject;

create schema CollectedDevices(
    devices List
);

create schema SingleDevice(
    device Device
);

insert into CollectedDevices
select
    findAllManagedObjectByFragmentType("c8y_IsDevice") as devices
from pattern[timer:interval(10 seconds)];

insert into SingleDevice
select
    singleDevice as device
from 
    CollectedDevices as devices unidirectional,
    CollectedDevices[devices@type(Device)] as singleDevice;

然后将为列表中的每个元素触发最后一条语句.

The last statement will then be triggered for each element int the list.

您可以在此处找到有关连接的esper文档: http://esper.espertech. com/release-5.4.0/esper-reference/html/epl_clauses.html#epl-join

You can find the esper documentation for the joins here: http://esper.espertech.com/release-5.4.0/esper-reference/html/epl_clauses.html#epl-join

这篇关于CEP列表作为单个项目(对托管对象进行迭代)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆