Alert on state change.

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

Alert on state change.

Rudra Tripathy
Hi All,

I have a use case where I am monitoring price change.

Lets s say the original price is $100
in case of 20% rise , send the alert.

In the stream I am getting updated prices.

If in the next data $200 comes, send the alerts.

Next I am getting 230 I would keep it but no alert
. When I would get 240., I would send the alert.

Is it possible to achieve using Flink.

Thanks in advance,
Rudra

Reply | Threaded
Open this post in threaded view
|

Re: Alert on state change.

Scott Kidder
Hi Rudra,

You could accomplish this with a rolling-fold on the stream of stock prices. The accumulator argument to the fold can track the last price that triggered an alert and the timestamp of the alert. When evaluating a new stock price it can compare the the price against the last one that triggered an alert. If it meets your alerting criteria, then send an alert and update the accumulator state to reflect the most recent stock price & timestamp.

Best,

--Scott Kidder



On Mon, Dec 19, 2016 at 7:15 AM, Rudra Tripathy <[hidden email]> wrote:
Hi All,

I have a use case where I am monitoring price change.

Lets s say the original price is $100
in case of 20% rise , send the alert.

In the stream I am getting updated prices.

If in the next data $200 comes, send the alerts.

Next I am getting 230 I would keep it but no alert
. When I would get 240., I would send the alert.

Is it possible to achieve using Flink.

Thanks in advance,
Rudra