-
Notifications
You must be signed in to change notification settings - Fork 159
Upgrade userorg-service to Play Framework 3.0.5 and Apache Pekko 1.0.3 #1275
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
base: release-8.1.0
Are you sure you want to change the base?
Changes from 27 commits
5814e6e
0fcd021
64fe4e7
d46d290
744f935
390a78d
4c87416
de20668
7c70c3c
0ec3485
1bd3f0c
ebca0e9
55a8472
10cdc0e
521d323
4a6bf0e
e236781
fc8da5e
d10ae89
679513a
33c3a67
c096eff
6180ada
1fe3a0f
16e698b
c6324b4
cb721b3
8a29128
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| # Play Framework 3.0.5 and Apache Pekko 1.0.2 Upgrade | ||
|
|
||
| ## Overview | ||
|
|
||
| This document describes the upgrade of userorg-service from Play Framework 2.7.2 with Akka 2.5.22 to Play Framework 3.0.5 with Apache Pekko 1.0.2. | ||
|
|
||
| ## Why This Upgrade | ||
|
|
||
| 1. License Compliance: Akka changed from Apache 2.0 to Business Source License 1.1, requiring commercial licenses for production use. Apache Pekko maintains Apache 2.0 license. | ||
| 2. Security: Play 2.7.2 and Akka 2.5.22 no longer receive security updates. | ||
| 3. Modernization: Access to latest features and performance improvements. | ||
|
|
||
| ## Technology Stack Changes | ||
|
|
||
| - Play Framework: 2.7.2 to 3.0.5 | ||
| - Actor Framework: Akka 2.5.22 to Apache Pekko 1.0.2 | ||
| - Scala: 2.12.11 to 2.13.12 | ||
| - Guice: 3.0 to 5.1.0 | ||
| - SLF4J: 1.6.1 to 2.0.9 | ||
| - Logback: 1.2.3 to 1.4.14 | ||
| - Jackson: 2.13.5 to 2.14.3 | ||
| - Netty: 4.1.44 to 4.1.93 | ||
|
|
||
| ## Key Changes | ||
|
|
||
| ### Dependencies | ||
|
|
||
| All Maven POM files updated with new versions. Play Framework groupId changed from com.typesafe.play to org.playframework. Scala library exclusions added to prevent version conflicts between Scala 2.12 and 2.13. | ||
|
|
||
| ### Source Code | ||
|
|
||
| 329 Akka imports migrated to Pekko across 130+ Java files: | ||
| - akka.actor.* to org.apache.pekko.actor.* | ||
| - akka.pattern.* to org.apache.pekko.pattern.* | ||
| - akka.routing.* to org.apache.pekko.routing.* | ||
| - akka.util.* to org.apache.pekko.util.* | ||
| - akka.testkit.* to org.apache.pekko.testkit.* | ||
|
|
||
| ### Configuration | ||
|
|
||
| application.conf files updated with Pekko namespaces: | ||
| - akka {} to pekko {} | ||
| - Actor system configurations migrated | ||
| - Serialization bindings updated | ||
| - Dispatcher references changed | ||
|
|
||
| ### Play 3.0 API Updates | ||
|
|
||
| - ActorStartModule: Implements play.libs.pekko.PekkoGuiceSupport | ||
| - CustomGzipFilter: Updated to Play 3.0 filter API | ||
| - ErrorHandler: Migrated exception handling to Pekko | ||
|
|
||
| ### Test Framework | ||
|
|
||
| 38+ test files updated: | ||
| - Replaced JavaTestKit.duration() with java.time.Duration.ofSeconds() | ||
| - Resolved Duration class ambiguity between java.time and scala.concurrent | ||
| - Fixed import conflicts | ||
|
|
||
| ### Scala Version Conflicts | ||
|
|
||
| Added exclusions to prevent Scala 2.12 transitive dependencies: | ||
| - Excluded scala-library and scala-reflect from cloud-store-sdk in platform-common | ||
| - Excluded scala-library and scala-reflect from platform-common and service dependencies in controller | ||
| - Explicitly declared scala-library 2.13.12 dependency | ||
|
|
||
| ## Build Instructions | ||
|
|
||
| Build all modules: | ||
| ``` | ||
| mvn clean install -Dmaven.test.skip=true | ||
| ``` | ||
|
|
||
| Build with test compilation: | ||
| ``` | ||
| mvn clean install -DskipTests | ||
| ``` | ||
|
|
||
| Create distribution package: | ||
| ``` | ||
| cd controller | ||
| mvn play2:dist | ||
| ``` | ||
|
|
||
| ## Migration Impact | ||
|
|
||
| Business Logic: No changes to business logic or functionality | ||
| API Compatibility: Maintained, as Pekko is API-compatible with Akka 2.6 | ||
| Code Changes: Primarily package name updates from akka to pekko | ||
| License: Now compliant with Apache 2.0 throughout the stack | ||
|
|
||
| ## Testing Recommendations | ||
|
|
||
| 1. Execute full unit test suite | ||
| 2. Run integration tests for actor communication | ||
| 3. Perform regression testing for all features | ||
| 4. Conduct performance benchmarking | ||
| 5. Test under production-like load | ||
|
|
||
| ## Files Modified | ||
|
|
||
| - POM files | ||
| - Java source files | ||
| - configuration files | ||
| - test files | ||
|
|
||
| ## Known Issues | ||
|
|
||
| Scala 2.12/2.13 Conflict: If you encounter NoClassDefFoundError for scala.collection.GenMap, verify dependency tree to ensure no Scala 2.12 artifacts are present. Run mvn dependency:tree and add exclusions for any scala-library or scala-reflect with version 2.12. | ||
|
|
||
| Play 3 will automatically apply gzip based on the Accept-Encoding header. You don’t need a custom Java filter. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| package controllers.location; | ||
|
|
||
| import akka.actor.ActorRef; | ||
| import org.apache.pekko.actor.ActorRef; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potential runtime incompatibility between Akka and Pekko ActorRef
Tell me moreWhat is the issue?The import change from Akka to Apache Pekko may cause runtime compatibility issues if the rest of the codebase still uses Akka actors or if the injected locationActor is still an Akka ActorRef. Why this mattersThis could lead to ClassCastException or NoClassDefFoundError at runtime when the dependency injection framework tries to inject an Akka ActorRef into a field expecting a Pekko ActorRef, or when the actor system tries to communicate between different actor implementations. Suggested change ∙ Feature PreviewEnsure that the entire actor system has been migrated to Pekko consistently. Verify that:
Example verification: // Ensure the injected actor is Pekko-based
@Inject
@Named("location_actor")
private org.apache.pekko.actor.ActorRef locationActor;Provide feedback to improve future suggestions💬 Looking for more details? Reply to this comment to chat with Korbit. |
||
| import com.fasterxml.jackson.databind.JsonNode; | ||
| import controllers.BaseController; | ||
| import java.util.Map; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| package filters; | ||
|
|
||
| import akka.util.ByteString; | ||
| import org.apache.pekko.util.ByteString; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unverified API compatibility in library migration
Tell me moreWhat is the issue?The import has been changed from Akka to Apache Pekko ByteString, but there's no verification that the Pekko ByteString API is fully compatible with the existing usage in the filter logic. Why this mattersIf the Apache Pekko ByteString implementation has different behavior or API differences compared to Akka's ByteString, this could cause runtime failures or unexpected behavior in the accumulator processing, potentially breaking request/response handling. Suggested change ∙ Feature PreviewVerify that Apache Pekko's ByteString is API-compatible with Akka's ByteString for the usage patterns in this filter. Test the filter functionality thoroughly after the migration to ensure request processing and accumulator behavior remains unchanged. Consider adding integration tests that verify the filter processes requests correctly with the new dependency. Provide feedback to improve future suggestions💬 Looking for more details? Reply to this comment to chat with Korbit. |
||
| import java.util.concurrent.Executor; | ||
| import javax.inject.Inject; | ||
| import play.libs.streams.Accumulator; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential DI incompatibility between Akka and Pekko ActorRef
Tell me more
What is the issue?
The import has been changed from Akka to Apache Pekko, but the injected ActorRef field may not be compatible if the dependency injection configuration still references Akka actors.
Why this matters
If the dependency injection framework is still configured to inject Akka ActorRef instances while the code expects Pekko ActorRef instances, this will cause runtime failures when the application tries to inject the userFeedActor dependency.
Suggested change ∙ Feature Preview
Ensure that the dependency injection configuration (likely in application.conf or a DI module) has been updated to create and inject Pekko ActorRef instances instead of Akka ones. Verify that the "user_feed_actor" binding creates a Pekko actor, not an Akka actor.
Provide feedback to improve future suggestions
💬 Looking for more details? Reply to this comment to chat with Korbit.