Flink CEP:对于不同类型的事件,用什么方法来加入数据流? [英] Flink CEP: Which method to join data streams for different type of events?

查看:18
本文介绍了Flink CEP:对于不同类型的事件,用什么方法来加入数据流?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有两种不同类型的数据流,一种提供天气数据,另一种提供车辆数据,我想使用 Flink 对数据进行复杂的事件处理.

Suppose that I have 2 different types of data streams, one providing weather data and the other providing vehicle data, and I would like to use Flink to do complex event processing on the data.

Flink 1.3.x 中哪个方法是正确使用的方法?我看到了不同的方法,如 Union、Connect、Window Join.基本上我只想尝试这样一个简单的 CEP:

Which method in Flink 1.3.x is the correct method to use? I saw different methods like Union, Connect, Window Join. Basically I just want to try a simple CEP like this:

IF weather is wet AND vehicle speed > 60 
WITHIN the last 10 seconds
THEN raise alert

谢谢!

推荐答案

在我看来,有两种方法可以解决这个问题:

In my opinion, there are two ways how you can solve this problem:

  1. 在使用 CEP 库之前,为不同类型的事件使用公共父类型并通过 union 方法连接两个流.

您可以使用 flink-siddhi 包来使用 SiddhiCEP 处理流,SiddhiCEP 提供了同时为多个数据流描述模式(通过 SiddhiQL)的方法.有关 flink-siddhi 的更多信息,请访问:https://haoch.github.io/flink-siddhi/.源代码可在 GitHub 上获得:https://github.com/haoch/flink-siddhi.SiddhiCEP 和 SiddhiQL 的文档:https://docs.wso2.com/display/CEP420/SiddhiQL+指南+3.1.

You can use flink-siddhi package to process the streams using SiddhiCEP what provides the way to describe a pattern (via SiddhiQL) for several data streams in the same time. More information about flink-siddhi here: https://haoch.github.io/flink-siddhi/. The source code is available on GitHub: https://github.com/haoch/flink-siddhi. Documentation for SiddhiCEP and SiddhiQL: https://docs.wso2.com/display/CEP420/SiddhiQL+Guide+3.1.

希望这些信息会有所帮助.

Hope, this information would be helpful.

这篇关于Flink CEP:对于不同类型的事件,用什么方法来加入数据流?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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