Esper: Chaining property access and method calls in EPL queries
-
30-10-2019 - |
Frage
I am currently struggling to get some Esper EPL queries to work. The queries are looking like this:
select a.center.distance(b.center) as delta
from pattern [
every-distinct(a.id, b.id) (
a=org.example.PositionEvent -> b=org.example.PositionEvent
)
]
When I try to compile this into an EPLStatement
via EPAdministrator.createEPL()
it throws the following exception:
com.espertech.esper.client.EPStatementException: Error starting statement: Could not load class by name 'a.center', please check imports
If I modify the event classes and the query to read like this
select a.distance(b) as delta
from pattern [
every-distinct(a.id, b.id) (
a=org.example.PositionEvent -> b=org.example.PositionEvent
)
]
it compiles just fine. Esper seems to interpret a.center.distance(...)
as a class name followed by a static method invocation, while it interprets a.distance(...)
as a method call on the object a
.
How can I make Esper interpret my original query as intended (i.e. as a property access followed by a method invocation)?
Keine korrekte Lösung