简体   繁体   English

集成WSO2 Siddhi CEP和Kafka

[英]Integrating WSO2 Siddhi CEP and Kafka

I'm currently in the process of integrating WSO2's Siddhi CEP and Kafka. 我目前正在整合WSO2的Siddhi CEP和Kafka。 I want to produce a Siddhi stream by receiving events from Kafka. 我想通过接收来自Kafka的事件来产生Siddhi流。 The Kafka data being received is in JSON format, where each event looks something like this: 接收到的Kafka数据为JSON格式,其中每个事件如下所示:

{  
   "event":{  
      "orderID":"1532538588320",
      "timestamps":[  
         15325,
         153
      ],
      "earliestTime":1532538
   }
}

The SiddhiApp that I'm trying to run in the WSO2 stream processor looks like this: 我试图在WSO2流处理器中运行的SiddhiApp看起来像这样:

@App:name('KafkaSiddhi')
@App:description('Consume events from a Kafka Topic and print the output.')

-- Streams
@source(type='kafka', 
topic.list = 'order-aggregates',
partition.no.list = '0',
threading.option = 'single.thread',
group.id = 'time-aggregates',
bootstrap.servers = 'localhost:9092, localhost:2181',
@map(type='json'))
define stream TimeAggregateStream (orderID string,timestamps 
object,earliestTime long);

@sink(type="log")
define stream TimeAggregateResultStream (orderID string, timestamps 
object, earliestTime long);

-- Queries
from TimeAggregateStream 
select orderID, timestamps, earliestTime
insert into TimeAggregateResultStream;

Running this app should log all of the data being updated in the order-aggregates Kafka cluster that I'm listening to. 运行此应用程序应将所有正在更新的数据记录在我正在侦听的订单聚合Kafka集群中。 But I see no output whatsoever when click run. 但是单击运行时,我看不到任何输出。

I can tell that there is some type of interaction between the WSO2 stream processor and the order-aggregates topic, because error messages are outputted in real-time whenever I run the application with inconsistent data types for my stream schema. 我可以说WSO2流处理器和订单聚合主题之间存在某种类型的交互,因为每当我为流模式使用不一致的数据类型运行应用程序时,错误消息就会实时输出。 The error messages look like this: 错误消息如下所示:

[2018-07-25_10-14-37_224] ERROR 
{org.wso2.extension.siddhi.map.json.sourcemapper.JsonSourceMapper} - 
Json message {"event":{"orderID":"210000000016183","timestamps": 
[1532538627000],"earliestTime":1532538627000}} contains incompatible 
attribute types and values. Value 210000000016183 is not compatible with 
type LONG. Hence dropping the message. (Encoded) 

However, when I have the schema setup correctly, I receive no output at all when I run the application. 但是,如果我正确设置了架构,则在运行应用程序时根本不会收到任何输出。 I really don't know how to make sense of this. 我真的不知道该如何理解。 When I try to debug this by putting a breakpoint into the line including 'insert into', the debugger never stops at that line. 当我尝试通过在包含“插入到”的行中插入断点来进行调试时,调试器永远不会在该行停止。

Can anyone offer some insight on how to approach this issue? 谁能提供一些有关如何解决此问题的见解?

We have added the object support for json mapper extension in the latest release of the extension. 我们在最新版本的扩展中添加了对json映射器扩展的对象支持。 Please download the extension[1] and replace the siddhi-map-json jar in /lib. 请下载扩展名[1]并替换/ lib中的siddhi-map-json jar。

[1] https://store.wso2.com/store/assets/analyticsextension/details/0e6a6b38-f1d1-49f5-a685-e8c16741494d [1] https://store.wso2.com/store/assets/analyticsextension/details/0e6a6b38-f1d1-49f5-a685-e8c16741494d

Best Regards, Ramindu. 最好的问候,拉明杜。

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

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