You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by Erdem erdfem <er...@gmail.com> on 2017/10/10 14:22:16 UTC

Get pattern events

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();
    }

Re: Get pattern events

Posted by Erdem erdfem <er...@gmail.com>.
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 <er...@gmail.com>:

> Thank you Kostas
>
> 2017-10-10 17:47 GMT+03:00 Kostas Kloudas <k....@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 <er...@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 <er...@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();
>> >>>>  }
>> >>>
>> >>
>> >>
>>
>>
>

Re: Get pattern events

Posted by Erdem erdfem <er...@gmail.com>.
Thank you Kostas

2017-10-10 17:47 GMT+03:00 Kostas Kloudas <k....@data-artisans.com>:

> The address is user@flink.apache.org
>
> You have to subscribe as described here https://flink.apache.org/
> community.html <https://flink.apache.org/community.html>
>
> Kostas
>
> > On Oct 10, 2017, at 4:40 PM, Erdem erdfem <er...@gmail.com>
> wrote:
> >
> > What is the address for user mailing?
> >
> > 2017-10-10 17:30 GMT+03:00 Kostas Kloudas <k....@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 <er...@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();
> >>>>  }
> >>>
> >>
> >>
>
>

Re: Get pattern events

Posted by Kostas Kloudas <k....@data-artisans.com>.
The address is user@flink.apache.org

You have to subscribe as described here https://flink.apache.org/community.html <https://flink.apache.org/community.html>

Kostas

> On Oct 10, 2017, at 4:40 PM, Erdem erdfem <er...@gmail.com> wrote:
> 
> What is the address for user mailing?
> 
> 2017-10-10 17:30 GMT+03:00 Kostas Kloudas <k....@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....@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 <er...@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();
>>>>  }
>>> 
>> 
>> 


Re: Get pattern events

Posted by Erdem erdfem <er...@gmail.com>.
What is the address for user mailing?

2017-10-10 17:30 GMT+03:00 Kostas Kloudas <k....@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....@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 <er...@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();
> >>   }
> >
>
>

Re: Get pattern events

Posted by Kostas Kloudas <k....@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....@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 <er...@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();
>>   }
> 


Re: Get pattern events

Posted by Kostas Kloudas <k....@data-artisans.com>.
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 <er...@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();
>    }