apache / pekko

Build highly concurrent, distributed, and resilient message-driven applications using Java/Scala
https://pekko.apache.org/
Apache License 2.0
1.2k stars 148 forks source link

feat: avoid nesting in Behavior Factories #1459

Open Roiocam opened 2 months ago

Roiocam commented 2 months ago

similar like #1444, but apply to timer and stash:

those nestings are pretty annoying, especially when i using AOSP format.


-          Behaviors.withTimers(t-> 
-              Behaviors.setup(ctx-> {
-                   // preStart something on here
-                  return new BehaviorXX();
-           }));
+          Behaviors.withTimersSetup((t, ctx) -> {
+             // preStart something on here
+              return new BehaviorXX();
+          });
He-Pin commented 2 months ago

@Roiocam Thanks, Tests is required too.