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

Create ReceiveActor implementation of AtLeastOnceDeliveryActor base class #1416

Closed
Aaronontheweb opened this issue Nov 12, 2015 · 6 comments
Closed

Comments

@Aaronontheweb
Copy link
Member

It would be really helpful to be able to use typed Receive<T> with the AtLeastOnceDeliveryActor base class within Akka.Persistence - as of right now all we have is the untyped implementation.

@Horusiath
Copy link
Contributor

On the JVM it's realized as trait, which allows for multiple inheritance - at-least-once-delivery semantics can be applied for any kind of actor, either persistent or not.

Since we don't have traits/multi-inheritance in C#, I think that this functionality should be resolved through composition: maybe we should create something like AtLeastOnceDeliverySemantic class that can be used as a regular field and initialized through new AtLeastOnceDeliverySemantic(Context) or even Context.GetAtLeastOnceDeliverySemantic().

@maxim-s maxim-s self-assigned this Nov 16, 2015
@Aaronontheweb
Copy link
Member Author

@Horusiath that's an idea... Have you and @maxim-s discussed this?

@maxim-s
Copy link
Contributor

maxim-s commented Nov 17, 2015

should I add Receive<T> instead of ReceiveCommand<T> ? I think ReceiveCommand<T> more reasonable for PersistentActorand AtLeastOnceDeliveryActor

@Horusiath
Copy link
Contributor

@maxim-s as AtLeastOnceDeliveryActor is persistent actor, it's methods should reflect persistent actors behavior. Also I've checked the possibilities of decomposing AtLeastOnceDeliverySemantic from actors and these are some of my thoughts:

  • This kind of semantic class needs basically only Context. There are two fields from persistent actor that are teoretically required. Usage of both can be opted out.
    • PersistenceId displayed in one of the error logs ⇒ can be replaced with actor Self field
    • IsRecovering is used inside Deliver method ⇒ my proposition is to move this as an optional argument of Deliver method (default: false). In persistent actor we provide custom Deliver method that could call _atLeastOnceDeliverySemantic.Deliver(actor, messageMapping, isRecovering: this.IsRecovering).
  • Then all, that's left is to initialize/dispose semantics object in correct actor lifecycle events.

Another enchancement would be moving config fields of AtLeastOnceDelivery into separate settings class - right now associated actor have each field in two versions: default config value and actual, overrideable field value that is used for managing semantics logic. If we could move all of these to separate settings object, we won't need any property overriding. We could apply different settings through new object instead.

maxim-s pushed a commit to maxim-s/akka.net that referenced this issue Nov 26, 2015
@maxim-s
Copy link
Contributor

maxim-s commented Nov 29, 2015

is it ready?

maxim-s pushed a commit to maxim-s/akka.net that referenced this issue Nov 30, 2015
@maxim-s
Copy link
Contributor

maxim-s commented Dec 1, 2015

PR #1469

Aaronontheweb added a commit that referenced this issue Dec 1, 2015
…e-delivery-actor-1416

#1416 created ReceiveActor implementation of AtLeastOnceDeliveryActor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants