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 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!