-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
feat: Implement Actor Model pattern with automatic actor ID and communication with loose coupling #3251Actor model #3255
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
Conversation
PR SummaryThis PR implements the Actor Model pattern in Java. It includes automatic actor ID assignment, multi-actor interaction with message passing, safe communication between actors, and fixes an infinite message loop. The implementation uses asynchronous message passing to enable building concurrent and distributed systems. The PR also includes updated documentation and diagrams. Changes
autogenerated by presubmit.ai |
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.
✅ LGTM!
Review Summary
Commits Considered (5)
- 9ad06e6: feat: update Actor Model implementation with multi-actor logic and loose coupling Implement Actor Model pattern #3232Actor model #3251
- dd1dcdd: Merge branch 'iluwatar:master' into actor-model
- 11abf48: feat: update Actor Model implementation with multi-actor logic Implement Actor Model pattern #3232Actor model #3251
- 3ee44ea: feat: Implement Actor Model pattern Implement Actor Model pattern #3232
- f543057: feat: Implement Actor Model pattern Implement Actor Model pattern #3232
Files Processed (11)
- actor-model/README.md (1 hunk)
- actor-model/etc/actor-model.urm.puml (1 hunk)
- actor-model/etc/actor_model-Actor_Model___UML_Class_Diagram.png (0 hunks)
- actor-model/pom.xml (1 hunk)
- actor-model/src/main/java/com/iluwatar/actormodel/Actor.java (1 hunk)
- actor-model/src/main/java/com/iluwatar/actormodel/ActorSystem.java (1 hunk)
- actor-model/src/main/java/com/iluwatar/actormodel/App.java (1 hunk)
- actor-model/src/main/java/com/iluwatar/actormodel/ExampleActor.java (1 hunk)
- actor-model/src/main/java/com/iluwatar/actormodel/ExampleActor2.java (1 hunk)
- actor-model/src/main/java/com/iluwatar/actormodel/Message.java (1 hunk)
- pom.xml (2 hunks)
Actionable Comments (0)
Skipped Comments (0)
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.
✅ LGTM!
Review Summary
Commits Considered (1)
- c6685e9: test: add unit test for actor model Implement Actor Model pattern #3232Actor model #3251
Files Processed (9)
- actor-model/pom.xml (1 hunk)
- actor-model/src/main/java/com/iluwatar/actormodel/Actor.java (1 hunk)
- actor-model/src/main/java/com/iluwatar/actormodel/ActorSystem.java (1 hunk)
- actor-model/src/main/java/com/iluwatar/actormodel/App.java (1 hunk)
- actor-model/src/main/java/com/iluwatar/actormodel/ExampleActor.java (1 hunk)
- actor-model/src/main/java/com/iluwatar/actormodel/ExampleActor2.java (1 hunk)
- actor-model/src/main/java/com/iluwatar/actormodel/Message.java (1 hunk)
- actor-model/src/test/java/com/iluwatar/actor/ActorModelTest.java (1 hunk)
- pom.xml (2 hunks)
Actionable Comments (0)
Skipped Comments (0)
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.
🚨 Pull request needs attention.
Review Summary
Commits Considered (1)
- c0ecf29: test: add test for App.java to increase coverage
Files Processed (1)
- actor-model/src/test/java/com/iluwatar/actor/ActorModelTest.java (1 hunk)
Actionable Comments (1)
-
actor-model/src/test/java/com/iluwatar/actor/ActorModelTest.java [44-57]
possible bug: "Improve test coverage for message passing."
Skipped Comments (0)
public void testMessagePassing() { | ||
ActorSystem system = new ActorSystem(); | ||
|
||
Actor srijan = new ExampleActor(system); | ||
Actor ansh = new ExampleActor2(system); | ||
|
||
system.startActor(srijan); | ||
system.startActor(ansh); | ||
|
||
ansh.send(new Message("Hello Srijan", srijan.getActorId())); | ||
|
||
// You can improve this later by capturing output or using mocks | ||
assertNotNull(srijan.getActorId()); | ||
} |
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.
The test testMessagePassing
doesn't verify the actual message passing between actors. It only asserts that actor IDs are not null. Consider adding assertions to check if the messages were correctly received and processed by the actors.
✅ Implementation Completed Added unit tests for all key classes and verified actual message passing logic. Increased code coverage to 93.9% (from 45.5%). Fixed Spotless formatting violations. Build & tests pass locally via mvn clean install and mvn test. Quality Gate passed on SonarCloud. Please review the PR when you get a chance. I'm happy to make further adjustments if needed! |
actor-model/src/main/java/com/iluwatar/actormodel/ExampleActor.java
Outdated
Show resolved
Hide resolved
actor-model/src/test/java/com/iluwatar/actor/ActorModelTest.java
Outdated
Show resolved
Hide resolved
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.
✅ LGTM!
Review Summary
Commits Considered (1)
- afd64e0: docs: add complete README for Actor Model pattern also implemented changes Implement Actor Model pattern #3232Actor model #3251
Files Processed (8)
- actor-model/README.md (1 hunk)
- actor-model/etc/Actor_Model_UML_Class_Diagram.png (0 hunks)
- actor-model/pom.xml (1 hunk)
- actor-model/src/main/java/com/iluwatar/actormodel/App.java (1 hunk)
- actor-model/src/main/java/com/iluwatar/actormodel/ExampleActor.java (1 hunk)
- actor-model/src/main/java/com/iluwatar/actormodel/ExampleActor2.java (1 hunk)
- actor-model/src/main/java/com/iluwatar/actormodel/Message.java (1 hunk)
- actor-model/src/test/java/com/iluwatar/actor/ActorModelTest.java (1 hunk)
Actionable Comments (0)
Skipped Comments (0)
|
Looks good! Thank you for the contribution 🎉 @all-contributors please add @ssrijan-007-sys for code |
I've put up a pull request to add @ssrijan-007-sys! 🎉 |
Description
This PR enhances the implementation of the Actor Model pattern in Java.
What’s included:
README.md
andetc/
are updatedCloses #3251
Checklist ✅
./mvnw spotless:apply
src/
README.md
etc/
diagrampom.xml
pom.xml
./mvnw clean install
Looking forward to your feedback!