Repository navigation
Actor Core Definitions
github-actions[bot] edited this page Jun 27, 2026
·
1 revision
The foundational components of the actor model are defined in ActorState.kt, ActorMessage.kt, and Actor.kt.
Defines the possible lifecycle states of an actor.
- Purpose: To represent the distinct operational phases an actor can be in.
-
States:
-
object Initialized: Actor is initialized but not yet started. -
object Running: Actor is active and processing messages. -
object Stopped: Actor has terminated its processing. -
data class Error(val exception: String): Actor encountered an error. -
data class Paused(val reason: String): Actor is temporarily paused.
-
- Provides an
override fun toString()for human-readable state representation.
Represents messages exchanged between actors.
- Purpose: To serve as an immutable data carrier for inter-actor communication.
-
Generic:
T- The type of the payload carried by the message. -
Key Properties:
-
correlationId: String: Unique ID for message tracking (defaults to a randomUuid.random().toString()). -
payload: T: The actual content of the message. -
sender: String?: Optional identifier of the sending actor. -
timestamp: Long: Message creation time (defaults toSystem.currentTimeMillis()). -
priority: MessagePriority: Enum (HIGH,NORMAL,LOW) indicating processing priority (defaults toNORMAL). -
metadata: Map<String, Any>: Additional contextual information (defaults toemptyMap()).
-
-
Factory Methods: Companion object provides
highPriority(),withMetadata(), andbetween()for convenient message creation.
A base class for handling specific types of ActorMessages, integrating with the port system.
-
Implements:
io.github.solaceharmony.core.kernel.channels.ports.Port.MessageHandler<ActorMessage<T>, ActorMessage<T>>. -
Abstract Method:
abstract suspend fun processMessage(message: ActorMessage<T>): ActorMessage<T>. - The
handle()method (required byPort.MessageHandler) callsprocessMessage().
The central abstraction for all actors in the system.
-
Implements:
io.github.solaceharmony.core.lifecycle.Lifecycle. -
Constructor:
-
id: String: Unique actor ID (defaults toUuid.random().toString()). -
name: String: Human-readable name (defaults to "Actor"). -
protected val scope: CoroutineScope: Coroutine scope for the actor's operations.
-
-
State Management:
- Manages its high-level state (
Initialized,Running,Stopped,Error,Paused) via an atomic_statevariable of typeActorState. - Uses an internal
DefaultLifecycleinstance (inner class implementingLifecycle) for basic start/stop/active status.
- Manages its high-level state (
-
Port-Based Communication:
- Actors can create and manage typed communication ports using the
createPort<T : Any>(name, messageClass, handler, ...)method. - Each port is an instance of an inner class
TypedPort<T : Any>, which wraps aio.github.solaceharmony.core.kernel.channels.ports.Port<T>(specifically, aBidirectionalPortis created). - The
TypedPorthandles incoming messages on its channel, processes them with a user-providedhandlerlambda, and includes timeout handling (processingTimeout) and metrics recording. - Message processing for each port runs in a separate coroutine job, managed by the actor.
- Provides methods
getPort(),removePort(),recreatePort(),disconnectPort().
- Actors can create and manage typed communication ports using the
-
Lifecycle Methods & Hooks:
-
start(): Transitions toRunningstate, starts internal lifecycle, callsonStart(). -
stop(): Transitions toStoppedstate, stops internal lifecycle, cancels all port processing jobs, disposes all ports, callsonStop(). -
pause(reason: String): Transitions toPausedstate. -
resume(): Transitions back toRunningfromPaused. -
dispose(): Callsstop(). -
isActive(): Reflects the internal lifecycle state. -
Abstract Hooks for Subclasses:
protected abstract suspend fun onStart()protected abstract suspend fun onStop()-
protected abstract suspend fun onMessage(message: ActorMessage<Any>): A general message handler, distinct from port-specific handlers.
-
-
Direct Message Sending (Abstract):
-
abstract suspend fun send(message: ActorMessage<Any>): Indicates actors can send messages, but the mechanism (e.g., to other actors via an actor system) is not defined in this base class. -
suspend fun sendToSelf(message: ActorMessage<Any>): Delivers a message to its ownonMessage()handler.
-
-
Error Handling:
-
protected open suspend fun handleMessageProcessingError(error: Throwable, message: Any): Hook for errors during port message handling. -
protected open suspend fun onError(error: Throwable, message: Any): General error hook.
-
-
Metrics: Contains a
protected val metrics = ActorMetrics()instance for collecting performance data.
Note: The actor system class diagram and its description have been moved to the wiki Actor System Class Diagram page.
SolaceCore SSOT wiki · published from wiki/ by .github/workflows/publish-wiki.yml · edit the source in the repo, not the wiki.
Orientation
- Architectural Deep Dive
- Architecture Overview
- Design vs Implementation
- Framework Actor System
- Framework Architectural Vision
- Framework Concurrency and Communication
- Framework Data Storage and Management
- Framework Deployment and Containerization
- Framework Development Roadmap
- Framework Hot-Pluggable System
- Framework Implementation Status
- Framework Observability and Monitoring
- Framework Port System
- Framework System Architecture
- Framework Workflow Management
- Project Status
- Project Status Report
- Quick Status
- Solace Core Framework Architecture
- SolaceCore Architecture Overview
- Vision & Solace AI
Runtime
- Actor Builder
- Actor Communication Sequence Diagram
- Actor Core Definitions
- Actor Graph View
- Actor Metrics
- Actor Module Architecture
- Actor Queue Hibernation and Correlation
- Actor Roadmap
- Actor State Recovery Subsystem
- Actor State Serialization Subsystem
- Actor Supervision Module
- Actor System Architecture
- Actor System Class Diagram
- Actor Usage Examples
- Compose App Features
- JVM Scripting Implementations
- Kernel & Ports
- Kernel Channel System
- Kernel Future Enhancements
- Kernel Module Architecture
- Kernel Port Implementations and Exceptions
- Kernel Port Usage Example
- Kernel Testing Strategy
- Lifecycle Class Diagram
- Lifecycle Management Architecture
- Pipeline DSL
- Real-Time UI Implementation
- Scripting Module Architecture
- Scripting Module Design
- Scripting Supporting Components
- Shared Memory
- Storage & Persistence
- Storage Abstractions Architecture
- Storage Caching Subsystem
- Storage Checklist
- Storage Compression Subsystem
- Storage Core Interfaces
- Storage Encryption Subsystem
- Storage File-Based Architecture
- Storage File-Based Implementations
- Storage In-Memory Architecture
- Storage In-Memory Implementations
- Storage JVM Serialization Utilities
- Storage Module Architecture
- Storage Serialization Compression Encryption
- Storage Specialized Interfaces Architecture
- Storage Status and Future Plans
- Storage Testing
- Storage Thread Safety Guide
- Storage Thread Safety and Deadlock Prevention
- Storage Transactions
- Storage Usage Examples
- Supervisor and Hot Swap
- SupervisorActor
- System Architecture Diagram
- Workflow Management Architecture
- Workflow Management Design Concept
- Workflow Orchestration
Solace AI
- Confusion Corrector
- Inference Cube
- Inference Cube Technical Architecture
- Long-Term Memory
- MCP and Tool Format
- Memory & Reflection
- Memory Compression
- Memory Feature Overview
- Memory Retrieval
- Mood & Emotional Model
- Mood Module Implementation
- Mouth Tool Technical Spec
- Multimodal Nudging
- Perception Actors
- Provider Specs
- Reflection Memory
- Solace AI Overview
- Supervisor AI
- Supervisor Emotional Model Integration
- Time Actor
- Voice & Mouth Tool
- Working Memory
- Zoom Level Technical Spec
- Zoom Levels
Reference
- Advanced Workflow Example
- Basic Actor Usage
- Build System and Dependencies
- Development Tooling and Practices
- Documentation Catalog
- Documentation Index
- Feature Index
- Glossary
- How the Wiki Publishes
- JVM Utilities
- Kotlin Implementation Details
- Kotlin-Aligned Architecture Overview
- Kotlin-Aligned Contributing
- Kotlin-Aligned Core Architectural Principles
- Kotlin-Aligned Daily Development Workflow
- Kotlin-Aligned Development Examples
- Kotlin-Aligned Development Workflow
- Kotlin-Aligned Documentation
- Kotlin-Aligned Implementation Status
- Kotlin-Aligned Key Concepts
- Kotlin-Aligned Known Issues
- Kotlin-Aligned Quick Start
- Kotlin-Aligned Running the System
- Kotlin-Aligned System Architecture
- LangChain Actor Code Changes
- LangChain Actor Usage Improvements
- LangChain ActorInterface Code Changes
- LangChain Best Practices
- LangChain Bugs
- LangChain Chain Implementation
- LangChain Code Changes
- LangChain Code Changes Rollout and Impact
- LangChain Configuration Management Improvements
- LangChain Configuration Recommendations
- LangChain Core Architecture Recommendations
- LangChain Directory Structure Changes
- LangChain Documentation Improvements
- LangChain Dynamic Wiring Rollout Notes
- LangChain Fix Proposal
- LangChain Implementation Priorities
- LangChain Lifecycle Management Improvements
- LangChain Memory Integration Recommendations
- LangChain Metrics and Observability Recommendations
- LangChain Migration Strategy
- LangChain New Files Needed
- LangChain New Packages to Add
- LangChain Package-by-Package Improvements
- LangChain Patterns
- LangChain Port Code Changes
- LangChain Port System Recommendations
- LangChain Port Usability Improvements
- LangChain Prompt Management Recommendations
- LangChain Recommendations
- LangChain Recommendations Rollout Plan
- LangChain Required Interface Changes
- LangChain Testing Changes
- LangChain Testing Improvements
- LangChain Testing Recommendations
- LangChain Tool Integration Recommendations
- LangChain Type-Safe Dynamic Wiring
- LangChain Type-Safe Dynamic Wiring System
- LangChain Usage Design Improvements
- Master Checklist
- Roadmap
- Roadmap Issues
- Roadmap Phase 1 Stability and Testing
- Roadmap Phase 2 Production Infrastructure
- Roadmap Phase 3 Documentation and Developer Experience
- Roadmap Phase 4 Graph Database Integration
- Roadmap Phase 5 Security Framework
- Roadmap Phase 6 Distributed System
- Roadmap Phase 7 Advanced Features
- Roadmap Phase 8 Ecosystem Development
- Roadmap Timeline and Success Metrics
- Setup Instructions
- Sketch Architecture
- Status Documentation
- Task 1 Core Tests
- Task 2 Connection Wiring
- Task 3 Concurrency Issues
- Task 4 Dynamic Registration
- Task 5 Integration Tests
- Task 6 Deadlock Detection
- Task Documentation
- Test Coverage Checklist
- Testing Strategy