Flink CEP:哪种方法可以为不同类型的事件加入数据流? [英] Flink CEP: Which method to join data streams for different type of events?

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

问题描述

假设我有2种不同类型的数据流,一种提供天气数据,另一种提供车辆数据,我想使用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处理流,这提供了一种方式(通过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 + Guide + 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天全站免登陆