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 · 13 comments
Closed

Add support for actor reminders #716

sebastianburckhardt opened this issue Apr 18, 2019 · 13 comments
Assignees
Labels
dtfx Enhancement Feature requests. fix-ready Indicates that an issue has been fixed and will be available in the next release.

Comments

@sebastianburckhardt
Copy link
Collaborator

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);
@sebastianburckhardt sebastianburckhardt added the Enhancement Feature requests. label Apr 18, 2019
@ghost ghost added the Needs: Triage 🔍 label Apr 18, 2019
@cgillum cgillum added this to the v2.0 Release milestone Apr 18, 2019
@cgillum
Copy link
Collaborator

cgillum commented Apr 18, 2019

Agreed, this would be good to have.

@olitomlinson
Copy link
Contributor

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 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
Copy link
Collaborator

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

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
Contributor

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

@sebastianburckhardt
Copy link
Collaborator Author

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 modified the milestones: v2.0.0-beta3, v2.0.0 Release Oct 2, 2019
@tomkuijsten
Copy link

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

@cgillum cgillum added the fix-ready Indicates that an issue has been fixed and will be available in the next release. label Dec 11, 2019
@cgillum
Copy link
Collaborator

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 as completed Dec 18, 2019
@olitomlinson
Copy link
Contributor

@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 commented Dec 31, 2019

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

@olitomlinson
Copy link
Contributor

@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.

@ajdvoynos
Copy link

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

@sebastianburckhardt Is there a way to cancel the timer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dtfx Enhancement Feature requests. fix-ready Indicates that an issue has been fixed and will be available in the next release.
Projects
None yet
Development

No branches or pull requests

6 participants