Registry Systems
Overview
Tasker features enterprise-grade registry systems that provide thread-safe operations, comprehensive validation, structured logging, and event integration. All registry systems have been modernized to use Concurrent::Hash storage and unified patterns.
Registry Systems
HandlerFactory Registry
The core registry for task handler management with namespace and version support.
Features:
Thread-Safe Operations:
Concurrent::Hashstorage eliminates race conditions3-Level Registry:
namespace_name β handler_name β version β handler_classInterface Validation: Fail-fast validation with detailed error messages
Conflict Resolution:
replace: trueparameter for graceful updatesStructured Logging: Every operation logged with correlation IDs
Usage:
# Thread-safe registration
Tasker::HandlerFactory.instance.register(
'payment_processor',
PaymentHandler,
namespace_name: 'payments',
version: '2.1.0',
replace: true # Handles conflicts gracefully
)
# Thread-safe retrieval
handler = Tasker::HandlerFactory.instance.get(
'payment_processor',
namespace_name: 'payments',
version: '2.1.0'
)
# List handlers in namespace
handlers = Tasker::HandlerFactory.instance.list_handlers(namespace: 'payments')
# Registry statistics
stats = Tasker::HandlerFactory.instance.stats
# => {
# total_handlers: 45,
# namespaces: ["payments", "inventory", "notifications"],
# versions: ["1.0.0", "1.1.0", "2.0.0"],
# thread_safe: true,
# last_registration: "2024-01-15T10:30:45Z"
# }PluginRegistry System
Format-based plugin discovery with auto-discovery capabilities for telemetry exporters.
Features:
Format-Based Discovery: Register plugins by export format (
:json,:csv,:prometheus)Auto-Discovery: Automatic plugin detection and registration
Thread-Safe Operations: Mutex-synchronized operations
Interface Validation: Method arity checking for plugin interfaces
Event Integration: Plugin registration triggers event system
Usage:
SubscriberRegistry System
Centralized event subscriber management with comprehensive validation.
Features:
Centralized Management: Single registry for all event subscribers
Event Validation: Validates subscriber methods match event names
Thread-Safe Operations: Concurrent access protection
Health Monitoring: Built-in health checks and statistics
Auto-Registration: Automatic registration during class loading
Usage:
Structured Logging
Every registry operation includes comprehensive structured logging with correlation IDs:
Interface Validation
All registries include fail-fast validation with detailed error messages:
Event Integration
Registry operations are fully integrated with Tasker's 56-event system:
Registry Events:
registry.handler_registered- Handler registration eventsregistry.plugin_registered- Plugin registration eventsregistry.subscriber_registered- Subscriber registration eventsregistry.validation_failed- Validation failure eventsregistry.conflict_resolved- Conflict resolution events
Event Payloads:
Thread Safety
All registry systems use thread-safe storage and operations:
Storage Types:
HandlerFactory:
Concurrent::Hashwith nested concurrent structuresPluginRegistry:
Concurrent::Hashwith mutex synchronizationSubscriberRegistry:
Concurrent::Hashwith atomic operations
Thread Safety Guarantees:
Atomic Operations: Registration and retrieval are atomic
Race Condition Prevention: No partial state during concurrent access
Memory Consistency: All threads see consistent registry state
Deadlock Prevention: Proper lock ordering and timeout handling
Health Monitoring
Built-in health monitoring and statistics for all registries:
Performance Characteristics
Registry Operation Performance:
Registration: O(1) average case with thread-safe operations
Retrieval: O(1) lookup with concurrent access
Listing: O(n) where n is entities in scope
Statistics: O(1) with cached computation
Memory Usage:
Efficient Storage: Minimal memory overhead per registered entity
Concurrent Structures: Memory-safe concurrent access
Garbage Collection: Proper cleanup and memory management
Best Practices
Registration Patterns
Error Handling
Performance Optimization
Troubleshooting
Common Issues
Thread Safety Issues:
Validation Failures:
Memory Leaks:
Debugging Registry State
Migration Guide
Upgrading from Legacy Registry
If upgrading from older Tasker versions:
Update Registration Code:
Handle Thread Safety:
Update Error Handling:
Related Documentation
Developer Guide - HandlerFactory usage patterns
Event System - Registry event integration
Telemetry - Plugin registry usage
Health Monitoring - Registry health endpoints
Last updated