Complex event processing in Erlang