Git Product home page Git Product logo

clj-esper's Introduction

clj-esper

A simple Clojure wrapper for Esper: Complex Event Processing.

Esper and NEsper enable rapid development of applications that process large volumes of incoming messages or events. Esper and NEsper filter and analyze events in various ways, and respond to conditions of interest in real-time.

It provides a SQL-like language across a stream of data:

SELECT COUNT(1) as success_count
FROM web_log.win:time(60 seconds)
WHERE status >= 200 AND status < 400
OUTPUT SNAPSHOT EVERY 1 SECONDS

Installing

A snapshot is available on Clojars. This can be added to your leiningen project.clj:

[clj-esper "1.0.0-SNAPSHOT"]

Usage

Esper is organised around events. clj-esper provides a defevent macro that makes it easier to build map event objects for esper (clj-esper uses Esper's Map Event Type).

(defevent TestEvent [a :int b :string])

Having defined an event, the with-esper macro can be used to build the Esper runtime and dispatch events into it.

(def output-events (atom []))
(defn- handler
  [atom]
  (fn [x]
    (swap! atom conj x)))

(def statement "SELECT a, b FROM TestEvent")

(with-esper service {:events #{TestEvent}
                   :uri "/something"}
      (attach-statement statement (handler output-events))
      (trigger-event (new-event TestEvent :a 1 :b "Hello"))

For more examples please see the tests.

TODO

License

Copyright © 2011 Paul Ingles.

Distributed under the GNU General Public License v2.0.

clj-esper's People

Contributors

pingles avatar bmabey avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.