Hi Emarotti,

It sounds like you want to process your streams based on the event time. This 
means, all your processing, windowing, timer and co are based on a timestamp 
that is provided by individual events. You can read more about here:
https://nightlies.apache.org/flink/flink-docs-release-1.16/docs/concepts/time/

When you wanna work with timers I can you point towards Flinks 
“ProcessFunction”. In this low level streaming operator you have more control 
over states, event time, watermarks and timers. You can, as you desire, 
register timers on certain incoming events and react when the timer is 
triggered. You can read more about it here:
https://nightlies.apache.org/flink/flink-docs-release-1.16/docs/dev/datastream/operators/process_function/

For your use case it’s very important to understand the principals how event 
time based streams are handled and what role watermarks play here. Its also 
possible to handle and react to late events.

I hope this helps to get you started. 

Best, Peter


> On 9. Feb 2023, at 08:22, Eugenio Marotti <emaro...@gmail.com> wrote:
> 
> Hi everyone. I'm developing a monitoring app and I want to use Flink to 
> process the event stream. I need to start a timer when an event is received 
> in Flink, send the timer value and stop the timer when another event is 
> received. Let me explain better. An event consists of an event name, a source 
> id and other fields. So I have something like this:
> 
> E1("A",1,...) -> E2("B",1,...) -> E3("C",1,...)
> 
> When I receive event "A" I want to start a timer (keyed by the source id) and 
> update a sink with the timer value periodically. When I receive event "C" I 
> want to stop the timer and update the sink with the final timer value. Is 
> there a way to accomplish that in Apache Flink?

Reply via email to