Skip to content

Implement Actor Model pattern #3232

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

Open
6 tasks
iluwatar opened this issue Mar 30, 2025 · 3 comments
Open
6 tasks

Implement Actor Model pattern #3232

iluwatar opened this issue Mar 30, 2025 · 3 comments

Comments

@iluwatar
Copy link
Owner

Description

The Actor Model is a concurrency paradigm in which independent “actors” encapsulate state and behavior, interacting solely through asynchronous message passing. This approach avoids shared mutable state and promotes highly scalable, loosely coupled systems. Actors can create new actors, send messages to other actors, and handle messages they receive.

Key Elements

  • Actors: Independent units that manage their own state and process messages.
  • Message Passing: Non-blocking communication between actors; no direct method calls or shared variables.
  • Isolation: Each actor’s state is private, limiting concurrency issues.
  • Supervision: Some actor frameworks use a hierarchy where parent actors supervise the lifecycle and errors of child actors.

References

  1. Akka Documentation (Actor Model in JVM)
  2. The Actor Model (Wikipedia)
  3. Java Design Patterns – Contribution Guidelines

Acceptance Criteria

  • Create a new module or package named actor-model (or similar).
  • Provide a minimal actor-based system where multiple actors exchange messages to accomplish a task.
  • Demonstrate key concepts: actor creation, message handling, isolation of state, and error handling or supervision.
  • Include a README (.md file) explaining the pattern, including code walkthrough and any relevant diagrams.
  • Write tests verifying actor interactions, ensuring correct behavior under concurrent loads.
  • Pass all repository checks (style conventions, CI build/tests).
@ssrijan-007-sys
Copy link
Contributor

I'd like to work on this. Planning to use Java's concurrency tools for a basic actor system.

@ssrijan-007-sys
Copy link
Contributor

✅ Implementation Completed
Implemented the Actor Model pattern with automatic actor ID and loose-coupling message communication.

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!

@ssrijan-007-sys
Copy link
Contributor

✅ Requested Changes Implemented

Refactored logging using Lombok’s @slf4j annotation

Implemented proper message-passing verification in the unit test (ActorModelTest)

Finalized and committed a fully structured README.md following the project format:

Includes real-world example, diagrams, benefits/trade-offs, usage, etc.

Added working links to references, tutorials, and related patterns

🔁 Kindly review the updates and let me know if any additional changes are needed. Happy to iterate further if required!

iluwatar pushed a commit that referenced this issue Apr 22, 2025
* feat: Implement Actor Model pattern #3232

* feat: Implement Actor Model pattern #3232

* feat: update Actor Model implementation with multi-actor logic #3251

* feat: update Actor Model implementation with multi-actor logic and loose coupling  #3251

* test: add unit test for actor model #3251

* test: add test for App.java to increase coverage

* docs: add complete README for Actor Model pattern also implemented changes #3251
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

2 participants