Erlang 事件处理库:Rivus CEP
Rivus CEP 是一个 Erlang 库用于复杂的事件处理,使用声明式的类似 SQL 的 DSL 来定义事件流的操作。
示例代码:
application:start(rivus_cep). QueryStr = "define correlation2 as select ev1.eventparam1, ev2.eventparam2, sum(ev2.eventparam3) from event1 as ev1, event2 as ev2 where ev1.eventparam2 = ev2.eventparam2 within 60 seconds; ". Producer = event_producer_1. {ok, SubscriberPid} = result_subscriber:start_link(). {ok, QueryPid} = rivus_cep:load_query(QueryStr, [Producer], [SubscriberPid], [{shared_streams, true}]). %% create some evetnts Event1 = {event1, gr1,b,10}. Event2 = {event2, gr2,bbb,20}. %% send the events rivus_cep:notify(Producer, Event1). rivus_cep:notify(Producer, Event2). %% or if you don't care about the producers rivus_cep:notify(Event1). rivus_cep:notify(Event2).
本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!