尝试使用 Esper Lambda 表达式

Trying to use an Esper Lambda Expression

我正在尝试扩展 where 枚举方法的 Esper 文档中的示例,但遇到了问题。这是有问题的例子:

select items.where(i => i.location.x = 0 and i.location.y = 0) as zeroloc
from LocationReport

我想做的事情看起来很简单。而不是 selecting items 匹配此表达式:

因此,每隔 n 秒,我将收到一组 LocationReport,其中每个报告在其项目列表中至少包含一个零位置。

作为参考,这里是 Esper 示例中使用的 Java 对象的结构:

public class LocationReport { List items; ...

public class Item { String assetId; // passenger or luggage asset id Location location; // (x,y) location boolean luggage; // true if this item is a luggage piece String assetIdPassenger; // if the item is luggage, contains passenger associated ...

public class Location { int x; int y; ...

背景细节:假设 LocationReport 是我感兴趣的实际对象...
像上面的示例一样使用 EPL,where 逻辑有效,但问题是,在仅返回 items 成员时,我看不到它来自 LocationReport class,它包含 [=] 之外的其他属性12=] 我的 UpdateListener 需要。

此外,可能不相关,但就我而言,我收到的消息率很高,其中许多 LocationReports 是重复的(或接近到足以被视为重复项),我的 where 子句将需要做出决定并且仅转发 "new" 条消息。

谢谢!

您可以将“*”添加到 select,这会为您提供事件对象。 select *, items.where(...) from LocationReport 您可以添加 "output every N seconds" 到输出。为时间 window 添加“#time(...)”。