Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Behaviors.same vs this

Tags:

akka

In akka typed, we have concept of Behavior.

If we want to retain same behaviour by an actor we return Behaviors.same when we are done processing a message. But then we can also return this. How are two different?

like image 549
Mandroid Avatar asked Nov 04 '25 21:11

Mandroid


1 Answers

They work the same. When using the FP:y-style of defining actors you will not have a this to return so you can only use Behaviors.same.

When defining actors in OO style (extending AbstractBehavior) you can use both, but we have tried to consistently use this in such samples in the docs and that's the recommendation.

like image 52
johanandren Avatar answered Nov 07 '25 16:11

johanandren



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!