feat: Make it possible to define appVersion later#2947
Merged
pjfanning merged 3 commits intoMay 9, 2026
Conversation
Motivation: Alternative to config app-version that is defined before ActorSystem startup. If the version is read from an external system (e.g. Kubernetes) this feature makes it possible to define it after system startup but before joining. Modification: - Added SetAppVersionLater/SetAppVersion messages to ClusterUserAction - Added laterAppVersion state and setAppVersionLater/setAppVersion private methods to ClusterCoreDaemon - Updated uninitialized, tryingToJoin, initialized receive handlers - Updated join() to defer when appVersion not yet available - Updated joining() to handle laterAppVersion for self - Added setAppVersionLater Scala + Java API to Cluster.scala - Added SetAppVersionLater case class + Java factory to cluster-typed/Cluster.scala - Added SetAppVersionLater handling in AdaptedClusterImpl.managerBehavior - Added AppVersionSpec multi-JVM test Result: Users can now supply appVersion from an external source (e.g. Kubernetes) after ActorSystem startup but before joining the cluster. Tests: - scalafmt: not installed, skipped - sbt: not installed, skipped References: Refs akka/akka-core#31934 Agent-Logs-Url: https://github.com/pjfanning/incubator-pekko/sessions/27cc73f3-2831-4301-8cd0-af3116012209 Co-authored-by: pjfanning <11783444+pjfanning@users.noreply.github.com>
… timing Agent-Logs-Url: https://github.com/pjfanning/incubator-pekko/sessions/27cc73f3-2831-4301-8cd0-af3116012209 Co-authored-by: pjfanning <11783444+pjfanning@users.noreply.github.com>
He-Pin
reviewed
May 9, 2026
| * `Join` or `JoinSeedNodes` immediately afterwards (before the `CompletionStage` is completed). The join will | ||
| * then wait for the `appVersion` to be completed. | ||
| */ | ||
| def create(appVersion: CompletionStage[Version]): SetAppVersionLater = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of https://github.com/akka/akka-core/releases/tag/v2.8.2 which is now available under
Apache License v2.0.
Motivation
Alternative to the config
app-versionthat is defined beforeActorSystemstartup.If the version is read from an external system (e.g. Kubernetes) this feature makes it possible to define it after system startup but before joining.
Port of akka/akka-core#31934.
Modification
SetAppVersionLater/SetAppVersionmessages toClusterUserActioninClusterDaemon.scalalaterAppVersionstate andsetAppVersionLater/setAppVersionprivate methods toClusterCoreDaemonuninitialized,tryingToJoin, andinitializedreceive handlers to handle the new messagesjoin()to defer sending aJoinmessage when the appVersionFutureis not yet completedjoining()to use the resolvedlaterAppVersionwhen adding self as a membersetAppVersionLater(Future[Version])(Scala) andsetAppVersionLater(CompletionStage[Version])(Java) API toCluster.scalaSetAppVersionLatercase class with Scala and Java constructors tocluster-typed/Cluster.scalaSetAppVersionLaterinAdaptedClusterImpl.managerBehaviorAppVersionSpecmulti-JVM testscala.jdk.FutureConverters(Pekko standard) instead ofscala.compat.java8.FutureConverters(Akka)Result
Users can now supply
appVersionfrom an external source (e.g. Kubernetes) afterActorSystemstartup but before joining the cluster. The cluster join will wait for theFuture/CompletionStageto complete before proceeding.References
Refs akka/akka-core#31934