Replace EnsureActive with Akka's StartEntity
See original GitHub issueAkka 2.5 introduces the StartEntity message specially meant to activate a sharded entity. On top of that it’s implemented so that it will not be delivered to the entity actor itself.
If we replaced the EnsureActive message used on ClusterDistribution and also ReadSideActor and TaggedOffsetProducerActor with StartEntity then the entity actors will not be cluster aware and will be more testable.
Changing this means the entity actor is responsible for starting itself once it’s activated since i can’t rely on an external EnsureActive
or StartEntity
message acting as trigger. This limitation requires a new way to provide the tag
that each instance of the entity actor will be responsible for.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
ensureActive - Kotlin
If the job was cancelled, thrown exception contains the original cancellation cause. This method is a drop-in replacement for the following code, but...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Have we maybe mixed things by offering a
prepare
method that has the responsibility to prepare what ever needs to be done + retrieve the last know offset?From the scaladoc/javadoc:
From the docs we are saying that there is a primary purpose + a piggy-back one. That’s a good example of missing concerns. We should have a
prepare
and afindLastestOffset
.Anyway, although I think it was a missed opportunity to separate these two concerns, I think that will be ok to call it from inside the closure as you mentioned. As the last paragraph states, it will be invoked at least once and possibly multiple times in case of failure. We won’t be breaking the contract if a user piggy-back it. Actually, we even recommended the user to piggy-back it.
This issue doesn’t make sense anymore. #999 is meant to replace
EnsureActive
withStartEntity
but in Lagom the sharded entity needs the payload of the message (EnsureActive
orStartEntity
). The problem is thatStartEntity
is not delivered to the entity. This is a feature of Akka Cluster Sharding since v 2.5: the message is used to actiavte the entity but is not delivered to the entity purposedly.When I originally wrote this issue I had another improvement in mind which is now it’s own issue. See #1006.