Re: Store a state at a RDBMS before TTL passes by

2023-07-11 Thread Shammon FY
Hi Anastasios,

I think you may need to implement a customized trigger to emit record when
a session window is created. You can refer to [1] for more detailed
information.

[1]
https://nightlies.apache.org/flink/flink-docs-master/docs/dev/datastream/operators/windows/#triggers

Best,
Shammon FY

On Tue, Jul 11, 2023 at 4:22 PM Anastasios Makris <
anastasios.makris...@gmail.com> wrote:

> Hi Shammon,
>
> I implemented a session window with a static time gap, followed by a
> reduce function that keeps only the latest record.
>
> Your proposed solution was what I was looking for.
> Thank you!
>
> But I have another question. What if I want to write the 1st record of a
> session window when it starts in order to know that it opened a new session
> window that currently processes the data?
> Is it possible?
>
>
> Best regards,
>
> Anastasis
>
> On Fri, Jun 16, 2023 at 10:04 AM Anastasios Makris <
> anastasios.makris...@gmail.com> wrote:
>
>> Thank you very much Shammon for your reply.
>> I am going to study this solution and write back to you as soon as
>> possible.
>>
>> Best Regards,
>> Anastasis
>>
>> On Fri, Jun 16, 2023 at 4:14 AM Shammon FY  wrote:
>>
>>> Hi Anastasios,
>>>
>>> What you want sounds like a session window [1], maybe you can refer to
>>> the doc for more details.
>>>
>>> [1]
>>> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/datastream/operators/windows/#session-windows
>>>
>>> Best,
>>> Shammon FY
>>>
>>> On Thu, Jun 15, 2023 at 10:03 PM Anastasios Makris <
>>> anastasios.makris...@gmail.com> wrote:
>>>
 Hi Flink users,

 I created a KeyedStream that tracks for each user of my website some
 metrics. It's time a user produces an event the metrics are recomputed and
 change.
 I would like to keep the outcome of a user's session at an RDBMS, which
 will be a single row.

 The first and obvious solution would be to Insert the row at the RDBMS
 and then update it, it's time something new occurs.

 I would like to ask if another solution is possible.
 For example, could we maybe schedule to use the RDBMS as a sink of the
 state before its TTL passes by?

 Best regards,
 Anastasis

>>>


Re: Store a state at a RDBMS before TTL passes by

2023-06-15 Thread Shammon FY
Hi Anastasios,

What you want sounds like a session window [1], maybe you can refer to the
doc for more details.

[1]
https://nightlies.apache.org/flink/flink-docs-master/docs/dev/datastream/operators/windows/#session-windows

Best,
Shammon FY

On Thu, Jun 15, 2023 at 10:03 PM Anastasios Makris <
anastasios.makris...@gmail.com> wrote:

> Hi Flink users,
>
> I created a KeyedStream that tracks for each user of my website some
> metrics. It's time a user produces an event the metrics are recomputed and
> change.
> I would like to keep the outcome of a user's session at an RDBMS, which
> will be a single row.
>
> The first and obvious solution would be to Insert the row at the RDBMS and
> then update it, it's time something new occurs.
>
> I would like to ask if another solution is possible.
> For example, could we maybe schedule to use the RDBMS as a sink of the
> state before its TTL passes by?
>
> Best regards,
> Anastasis
>


Store a state at a RDBMS before TTL passes by

2023-06-15 Thread Anastasios Makris
Hi Flink users,

I created a KeyedStream that tracks for each user of my website some
metrics. It's time a user produces an event the metrics are recomputed and
change.
I would like to keep the outcome of a user's session at an RDBMS, which
will be a single row.

The first and obvious solution would be to Insert the row at the RDBMS and
then update it, it's time something new occurs.

I would like to ask if another solution is possible.
For example, could we maybe schedule to use the RDBMS as a sink of the
state before its TTL passes by?

Best regards,
Anastasis