Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for actor reminders #716

Closed
sebastianburckhardt opened this issue Apr 18, 2019 · 12 comments
Closed

Add support for actor reminders #716

sebastianburckhardt opened this issue Apr 18, 2019 · 12 comments

Comments

@sebastianburckhardt
Copy link
Collaborator

@sebastianburckhardt sebastianburckhardt commented Apr 18, 2019

When writing samples it became clear that there are situations where an actor wants to send itself a message with a time delay.

I believe we should support this, perhaps by adding a method along the lines of

ctx.ScheduleOperation(TimeSpan delay, string operationName, object operationContent);
@cgillum
Copy link
Collaborator

@cgillum cgillum commented Apr 18, 2019

Agreed, this would be good to have.

@olitomlinson
Copy link
Contributor

@olitomlinson olitomlinson commented Apr 19, 2019

This is a very desirable feature of an Actor!

While your in the design phase, it might be worth checking out Service Fabric Actor Timers & Reminders for some inspiration!

https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-actors-timers-reminders

@sebastianburckhardt sebastianburckhardt self-assigned this Apr 24, 2019
@sebastianburckhardt
Copy link
Collaborator Author

@sebastianburckhardt sebastianburckhardt commented Apr 26, 2019

(BTW, based on feedback we renamed actor to entity - just a new name, same thing.)

After going through a few designs my plan is to support as a more general feature which allows an optional scheduleAtUtc argument to all the SignalEntity functions:

ctx.SignalEntity(entityId, operationName, operationInput, scheduleAtUtc);

Then a "reminder" requirement can be implemented by having an entity send a signal to itself, scheduled for some time in the future, e.g.:

ctx.SignalEntity(ctx.Self, operationName, operationInput, DateTime.UtcNow + TimeSpan.FromSeconds(30));

I ran into a gating issue Azure/durabletask#285 so I'll probably delay work on this for a while.

@cgillum cgillum removed this from the v2.0 Release milestone Jul 13, 2019
@cgillum cgillum added this to the v2.0.0-beta2 milestone Jul 13, 2019
@cgillum cgillum removed this from the v2.0.0-beta2 milestone Aug 28, 2019
@cgillum cgillum added this to the v2.0.0-beta3 milestone Aug 28, 2019
@cgillum
Copy link
Collaborator

@cgillum cgillum commented Sep 17, 2019

@sebastianburckhardt The underlying blockers have been resolved for this work item. Do you think you can resume working on it and have it in for beta3? I have a use case for it that I'd like to try out. :)

@sebastianburckhardt
Copy link
Collaborator Author

@sebastianburckhardt sebastianburckhardt commented Sep 17, 2019

Yes, I have already resumed work on this. Currently in the debugging stage... some things are still not quite working as expected inside DTFx, when combining timers and ContinueAsNew.

@jeffhollan
Copy link
Member

@jeffhollan jeffhollan commented Sep 19, 2019

Very excited about this feature - great to hear it's unblocked 🤞

@sebastianburckhardt
Copy link
Collaborator Author

@sebastianburckhardt sebastianburckhardt commented Sep 20, 2019

I fixed one problem, but then hit another DTFx issue where timers cause duplicate activations of entities: Azure/durabletask#318. We'll have to fix that first.

@cgillum cgillum added the dtfx label Sep 25, 2019
@cgillum cgillum removed this from the v2.0.0-beta3 milestone Oct 2, 2019
@cgillum cgillum added this to the v2.0.0 Release milestone Oct 2, 2019
@tomkuijsten
Copy link

@tomkuijsten tomkuijsten commented Oct 3, 2019

Would love to test this feature. @sebastianburckhardt will there also be an option to cancel / postpone the timer?

@cgillum
Copy link
Collaborator

@cgillum cgillum commented Dec 18, 2019

Closing completed issues in preparation for the v2.1 release.

To answer @tomkuijsten's question, we don't have an ability to cancel/postpone timers in this release. Please feel free to open an issue requesting this as a new feature and let us know how you would intend to use it.

@cgillum cgillum closed this Dec 18, 2019
@olitomlinson
Copy link
Contributor

@olitomlinson olitomlinson commented Dec 30, 2019

@cgillum Is there a time limit on how far into the future a reminder can be scheduled for? (Similar to the 7 day limit on orchestration timers)

@cgillum
Copy link
Collaborator

@cgillum cgillum commented Dec 31, 2019

@olitomlinson yes, the 6 day limit applies here as well. :)

@olitomlinson
Copy link
Contributor

@olitomlinson olitomlinson commented Dec 31, 2019

@cgillum thank you.

FYI This is a real problem for my use-case as I am looking to use the built-in reminder to schedule a tidy-up operation on each Entity so that it complies with GDPR policy.

In my use-case I will accumulate hundreds of millions of Entitys that will need to redact parts of their state at completely arbitrary times ranging from a few seconds to a few years.

I will have to externalise this part of the process and utilise Service Bus to schedule the job at the right time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants