Looking at docs/dev/libs/cep.md , there're 3 examples using lambda.
Here is one:

Pattern<Event, ?> pattern = Pattern.begin("start").where(evt -> evt.getId()
== 42)

Your syntax should be supported.
I haven't found such example in test code, though.

FYI

On Sun, Jun 11, 2017 at 2:42 PM, David Koch <ogd...@googlemail.com> wrote:

> Hello,
>
> I cannot get patterns expressed as lambdas like:
>
> Pattern<Event, Event> pattern1 = Pattern.<Event> begin("start")
>     .where(evt -> evt.key.length() > 0)
>     .next("last").where(evt -> evt.key.length() >
> 0).within(Time.seconds(5));
>
> to compile with Flink 1.3.0. My IDE doesn't handle it and building on
> command line with maven does not work either. The exception given by a
> maven build in command line is:
>
> [ERROR] The method where(IterativeCondition<Event>) in the type
> Pattern<Event,Event> is not applicable for the arguments ((<no type> evt)
> -> {})
> [ERROR] /Users/xxxx/xxx/cep-test/src/main/java/com/xxxx/xxxx/
> CEPTest.java:[83]
> [ERROR] .where(evt -> evt.key.length() > 0)
> [ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^
> [ERROR] The target type of this expression must be a functional interface
>
> I used the standard pom.xml generated by the Flink quick start archetype.
> If I recall correctly this is something that used to work with Flink
> 1.2.0-SNAPSHOT back when I tested CEP for the first time.
>
> Any idea why this could be the case or maybe my syntax is not correct? I
> include my maven information below.
>
> Thank you,
>
> David
>
>
> Davids-MacBook-Pro-2:cep-test dkoch$ mvn -v
> Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5;
> 2015-11-10T17:41:47+01:00)
> Maven home: /usr/local/Cellar/maven/3.3.9/libexec
> Java version: 1.8.0_102, vendor: Oracle Corporation
> Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_
> 102.jdk/Contents/Home/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "mac os x", version: "10.11.6", arch: "x86_64", family: "mac"
>

Reply via email to