RagHaven
RagHaven

Reputation: 4337

How does Esper match events with the appropriate queries

I am using ESPER for streaming event processing. I am creating Statements and then adding them to the CEP Engine as follows. Is this the right approach for processing large quantities(million events per minute) of data?

    Configuration cepConfig = new Configuration();
    cepConfig.addEventType("StockTick", Tick.class.getName());
    EPServiceProvider cep = EPServiceProviderManager.getProvider("myCEPEngine", cepConfig);
    EPRuntime cepRT = cep.getEPRuntime();

    EPAdministrator cepAdm = cep.getEPAdministrator();
    EPStatement cepStatement = cepAdm.createEPL("select * from " +
            "StockTick(symbol='AAPL').win:length(2) " +
            "having avg(price) > 6.0");
    EPStatement cepStatement2 = cepAdm.createEPL("select * from " +
            "StockTick(symbol='AAPL').win:length(2) " +
            "having avg(price) > 7.0");
    CEPListener c = new CEPListener();
    cepStatement.addListener(c);
    cepStatement2.addListener(c);

I add events using:

cepRT.sendEvent()

How does ESPER map the event to the query which it must be evaluated? If I had an event for the Stock type IBM, does it get evaluated against these statements?

Upvotes: 0

Views: 197

Answers (1)

user650839
user650839

Reputation: 2594

Esper looks at filter expressions, in your example "symbol=AAPL". These get entered into a series of reverse indexes. You can see whether Esper evaluates a statement using @audit.

Upvotes: 1

Related Questions