Re: Statefun: cancel "sendAfter"

Posted by Tzu-Li (Gordon) Tai on
URL: http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/Statefun-cancel-sendAfter-tp41208p41222.html

Hi,

You are right, currently StateFun does not support deleting a scheduled delayed message.

StateFun supports delayed messages by building on top of two Flink constructs: 1) registering processing time timers, and 2) buffering the message payload to be sent in state.

The delayed messages are kept in the Flink state of the sending operator, and timers are registered on the sending operator as well. So technically, there doesn't seem to be a blocker for deleting a delayed message and its associated timer, if it hasn't been sent yet.

Can you maybe open a JIRA ticket for this, so we have something that tracks it?
Also cc'ing Igal, who might have more comments on whether supporting this makes sense.

Cheers,
Gordon


On Wed, Feb 3, 2021 at 3:51 AM Stephan Pelikan <[hidden email]> wrote:

Hi,

 

I think about using „sendAfter“ to implement some kind of timer functionality. I’m wondering if there is no possibility to cancel delayed sent message!

 

In my use case it is possible that intermediate events make the delayed message obsolete. In some cases the statefun of that certain ID is cleared (clear all state variables) and does not exist anymore. In other cases the statefun of that ID still exists (and its state). In the latter case I could ignore the delayed message, but what about those statefun which do not exist anymore?

 

Additionally there can be millions of delayed messages which I do not need any more and some delays are also hours, days or even months. I don’t want to pollute my state with this because it will inflate the size of my checkpoints.

 

There are no hints in the docs (https://ci.apache.org/projects/flink/flink-statefun-docs-release-2.2/sdk/java.html#sending-delayed-messages) how those situations are treated. I found in the Flink’s docs that timers of keyed processors can be deleted. As far as I know statefuns are based on those processors, so I hope that there is something about it. I hope someone can clarify what I can expect and how those situations are handled internally.

 

Thanks,

Stephan