Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Akka: Adding a delay to a durable mailbox

I am wondering if there is some way to delay an akka message from processing?

My use case: For every request I have, I have a small amount of work that I need to do and then I need to additional work two hours later.

Is there any easy way to delay the processing of a message in AKKA? I know I can probably setup an external distributed queue such as ActiveMQ, RabbitMQ which probably has this feature but I rather not.

I know I would need to make the mailbox durable so it can survive restarts or crashes. We already have mongo setup so I probably be using the MongoBasedMailbox for durability.

like image 856
Tihom Avatar asked Nov 12 '22 14:11

Tihom


1 Answers

Temporal Workflow is capable of supporting your use case with minimal effort. You can think about it as a Durable Actor platform. When actor state including threads and local variables is preserved across process restarts.

Temporal offers a lot of other features for task processing.

  • Built it exponential retries with unlimited expiration interval
  • Failure handling. For example, it allows executing a task that notifies another service if both updates couldn't succeed during a configured interval.
  • Support for long running heartbeating operations
  • Ability to implement complex task dependencies. For example to implement chaining of calls or compensation logic in case of unrecoverable failures (SAGA)
  • Gives complete visibility into the current state of the update. For example, when using queues all you know if there are some messages in a queue and you need additional DB to track the overall progress. With Temporal every event is recorded.
  • Ability to cancel an update in flight.
  • Throttling of requests

See the presentation that goes over the Temporal programming model. It talks about Cadence which is the predecessor of Temporal.

like image 180
Maxim Fateev Avatar answered Nov 15 '22 07:11

Maxim Fateev