I'm new to Service Fabric and wonder if there is something in it that helps me to implement this feature or at least you can advise me the best approach for it:
Actor1 is tend to be called either very frequently like multiple times a second or stays inactive for hours. Once wave of frequent calls is over, Actor1 needs to call related Actor2 (other type of actor) to run some pretty heavy and resource consuming operation. So ideally Actor1 should wait couple of seconds of its own inactivity (no more calls) to proceed on calling Actor2. It's Ok for Actor2 got delayed call measured in 2-5 seconds, but no more than that. In other words Actor1 should be able to somehow accumulate multiple frequent calls before throwing one single call to Actor2 until next series of calls.
In Actor1, you could put work in a queue (persist the queue as state) and then de-queue items periodically, when traffic slows down for a while. For that, you can use a timer, e.g. ActorTimer
.
The items can then be sent to Actor2 in the background.