Search code examples
methodsesperinvocationsom

Invoke Method with client.soda ( Statement Object Model )


I am trying to build Esper EPL statements in Java.

I use the com.espertech.esper.client.soda lib for this, but I can't find a tutorial to help me.

The PatternExpressions are the only part that I need as of now.

As an example let's use the EPL:

every a=Event((a).getEventTypeCode()='E00001')

So he should trigger on every Event with the event type code E00001, we get the code by calling the getEventTypeCode Method.

How do I project this to SOM?

With:

PatternExpr pattern = Patterns.everyFilter("Event","a");

I only get:

every a=Event

(of course)

I know there is a class called "MethodInvocationStream" but I don't know how to use it. And I cannot find examples for its use.

Thanks to user650839 I found out how to add Methods via SOM. Here is a simple EPL as an SOM Object: https://i.sstatic.net/wFfZv.jpg EPL as SOM Object


Solution

  • One source of info is the javadoc. You could simply do the reverse and compile EPL text to a model object and inspect that. Use "epAdmin.compileEPL", the output is the same object you want to build via API.\