flink-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erdem erdfem <erdemyayla...@gmail.com>
Subject Re: Get pattern events
Date Wed, 11 Oct 2017 15:21:09 GMT
Hello again,

I can get context values. But pattern alarm gives combinations of
matchedevents. How can i disable it?

.followedBy("second").where(new IterativeCondition<ObjectNode>() {
    @Override
    public boolean filter(ObjectNode jsonNodes, Context<ObjectNode>
context) throws Exception {
        int count = jsonNodes.get("quantity").asInt();
        for (ObjectNode node : context.getEventsForPattern("first"))
        {
            count += node.get("quantity").asInt();
        }

          return   Integer.compare(count,4) >= 0;
    }
}).times(1).;

I except this:
Alert [message  [{"UserId":112,"user_gender":"E","quantity":1},
{"UserId":113,"user_gender":"E","quantity":1},
{"UserId":114,"user_gender":"E","quantity":1},
{"UserId":115,"user_gender":"E","quantity":1}]]

But i recieve below rows

Alert [Kampanyalanmasi gereken musteri
[{"UserId":112,"user_gender":"E","quantity":1},
{"UserId":113,"user_gender":"E","quantity":1},
{"UserId":114,"user_gender":"E","quantity":1}]]
Alert [Kampanyalanmasi gereken musteri
[{"UserId":112,"user_gender":"E","quantity":1},
{"UserId":113,"user_gender":"E","quantity":1},
{"UserId":114,"user_gender":"E","quantity":1},
{"UserId":115,"user_gender":"E","quantity":1}]]
Alert [Kampanyalanmasi gereken musteri
[{"UserId":113,"user_gender":"E","quantity":1},
{"UserId":114,"user_gender":"E","quantity":1},
{"UserId":115,"user_gender":"E","quantity":1}]]








2017-10-10 17:51 GMT+03:00 Erdem erdfem <erdemyaylamis@gmail.com>:

> Thank you Kostas
>
> 2017-10-10 17:47 GMT+03:00 Kostas Kloudas <k.kloudas@data-artisans.com>:
>
>> The address is user@flink.apache.org
>>
>> You have to subscribe as described here https://flink.apache.org/commu
>> nity.html <https://flink.apache.org/community.html>
>>
>> Kostas
>>
>> > On Oct 10, 2017, at 4:40 PM, Erdem erdfem <erdemyaylamis@gmail.com>
>> wrote:
>> >
>> > What is the address for user mailing?
>> >
>> > 2017-10-10 17:30 GMT+03:00 Kostas Kloudas <k.kloudas@data-artisans.com
>> >:
>> >
>> >> Also this topic seems to be more suitable for the user mailing, and not
>> >> the dev one.
>> >> Could you move the discussion there?
>> >>
>> >> Thanks,
>> >> Kostas
>> >>
>> >>> On Oct 10, 2017, at 4:29 PM, Kostas Kloudas <
>> k.kloudas@data-artisans.com>
>> >> wrote:
>> >>>
>> >>> Hi Erdem,
>> >>>
>> >>> Could you share also your pattern?
>> >>> If the “first” pattern has no quantifier, then it is expected to
have
>> >> only one event.
>> >>>
>> >>> Kostas
>> >>>
>> >>>> On Oct 10, 2017, at 4:22 PM, Erdem erdfem <erdemyaylamis@gmail.com>
>> >> wrote:
>> >>>>
>> >>>> Hello,
>> >>>>
>> >>>> I want to take get pattern events. I use below code. When debug,
>> context
>> >>>> has one event. I cant see other events. Can you help me?
>> >>>>
>> >>>> for (ObjectNode node : context.getEventsForPattern("first")) {
>> >>>>  count += node.get(criterias.getPropName()).asInt();
>> >>>>  }
>> >>>
>> >>
>> >>
>>
>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message