0

Is it possible to cancel a scheduled operation in azure function durable entity ? Below is an example code.I want to cancel the call to operation "DeviceTimeout"after it is scheduled.

Entity.Current.SignalEntity(Entity.Current.EntityId, DateTime.UtcNow.Add(TimeSpan.FromSeconds(30)), nameof(DeviceTimeout));
Peter Bons
  • 26,826
  • 4
  • 50
  • 74
Nirbhay Jha
  • 491
  • 5
  • 13
  • Maybe not so elegant but you may create a durable orchestrator that recieves the signal and the execution time. Then in the orcestrator wait until execution time and check for a custom cancel signal. If not found then execute entity signal immediatly otherwise dont execute signal. – Bjorne Jun 14 '21 at 14:50

1 Answers1

1

Unfortunately not. There is an open issue requesting this ability but afaik it has not been implemented yet:

I can' think of a very straightforward API to provide this. One approach would be to include some sort of unique identifier for the signal so that a cancellation request can be precisely matched to the signal being cancelled. But there are some open questions on what exactly the implementation would have to guarantee, and whether that can lead to new issues. For example, would we need to store a cancellation request that we can't match to a signal until such a signal arrives? what if it never arrives?

I suppose the next best thing is to just exit immediately once the operation is executed.

Peter Bons
  • 26,826
  • 4
  • 50
  • 74