Skip to content

feat: Make it possible to define appVersion later#2947

Merged
pjfanning merged 3 commits into
apache:mainfrom
pjfanning:copilot/copy-akka-core-pr-31934-for-pekko
May 9, 2026
Merged

feat: Make it possible to define appVersion later#2947
pjfanning merged 3 commits into
apache:mainfrom
pjfanning:copilot/copy-akka-core-pr-31934-for-pekko

Conversation

@pjfanning

@pjfanning pjfanning commented May 8, 2026

Copy link
Copy Markdown
Member

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-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.

Port of akka/akka-core#31934.

Modification

  • Added SetAppVersionLater / SetAppVersion messages to ClusterUserAction in ClusterDaemon.scala
  • Added laterAppVersion state and setAppVersionLater / setAppVersion private methods to ClusterCoreDaemon
  • Updated uninitialized, tryingToJoin, and initialized receive handlers to handle the new messages
  • Updated join() to defer sending a Join message when the appVersion Future is not yet completed
  • Updated joining() to use the resolved laterAppVersion when adding self as a member
  • Added setAppVersionLater(Future[Version]) (Scala) and setAppVersionLater(CompletionStage[Version]) (Java) API to Cluster.scala
  • Added SetAppVersionLater case class with Scala and Java constructors to cluster-typed/Cluster.scala
  • Handled SetAppVersionLater in AdaptedClusterImpl.managerBehavior
  • Added AppVersionSpec multi-JVM test
  • Uses scala.jdk.FutureConverters (Pekko standard) instead of scala.compat.java8.FutureConverters (Akka)

Result

Users can now supply appVersion from an external source (e.g. Kubernetes) after ActorSystem startup but before joining the cluster. The cluster join will wait for the Future/CompletionStage to complete before proceeding.

References

Refs akka/akka-core#31934

Copilot AI and others added 2 commits May 8, 2026 23:16
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>
@pjfanning pjfanning added this to the 2.0.0-M2 milestone May 8, 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 = {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe better with _<: Version

@He-Pin He-Pin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@pjfanning pjfanning merged commit f2eb52a into apache:main May 9, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants