Get pattern events

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Get pattern events

Erdem erdfem
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();
    }
Reply | Threaded
Open this post in threaded view
|

Re: Get pattern events

Kostas Kloudas
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 <[hidden email]> 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();
>    }

Reply | Threaded
Open this post in threaded view
|

Re: Get pattern events

Kostas Kloudas
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 <[hidden email]> 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 <[hidden email]> 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();
>>   }
>

Reply | Threaded
Open this post in threaded view
|

Re: Get pattern events

Erdem erdfem
What is the address for user mailing?

2017-10-10 17:30 GMT+03:00 Kostas Kloudas <[hidden email]>:

> 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 <[hidden email]>
> 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 <[hidden email]>
> 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();
> >>   }
> >
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Get pattern events

Kostas Kloudas
The address is [hidden email]

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 <[hidden email]> wrote:
>
> What is the address for user mailing?
>
> 2017-10-10 17:30 GMT+03:00 Kostas Kloudas <[hidden email]>:
>
>> 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 <[hidden email]>
>> 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 <[hidden email]>
>> 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();
>>>>  }
>>>
>>
>>

Reply | Threaded
Open this post in threaded view
|

Re: Get pattern events

Erdem erdfem
Thank you Kostas

2017-10-10 17:47 GMT+03:00 Kostas Kloudas <[hidden email]>:

> The address is [hidden email]
>
> 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 <[hidden email]>
> wrote:
> >
> > What is the address for user mailing?
> >
> > 2017-10-10 17:30 GMT+03:00 Kostas Kloudas <[hidden email]>:
> >
> >> 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 <
> [hidden email]>
> >> 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 <[hidden email]>
> >> 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();
> >>>>  }
> >>>
> >>
> >>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Get pattern events

Erdem erdfem
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 <[hidden email]>:

> Thank you Kostas
>
> 2017-10-10 17:47 GMT+03:00 Kostas Kloudas <[hidden email]>:
>
>> The address is [hidden email]
>>
>> 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 <[hidden email]>
>> wrote:
>> >
>> > What is the address for user mailing?
>> >
>> > 2017-10-10 17:30 GMT+03:00 Kostas Kloudas <[hidden email]
>> >:
>> >
>> >> 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 <
>> [hidden email]>
>> >> 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 <[hidden email]>
>> >> 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();
>> >>>>  }
>> >>>
>> >>
>> >>
>>
>>
>