RivusCEP是一个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 evetntsEvent1 = {event1, gr1,b,10}.Event2 = {event2, gr2,bbb,20}.%% send the eventsrivus_cep:notify(Producer, Event1).rivus_cep:notify(Producer, Event2).%% or if you don't care about the producersrivus_cep:notify(Event1).rivus_cep:notify(Event2).
评论