smart_message 0.0.10 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/deploy-github-pages.yml +38 -0
  3. data/.gitignore +5 -0
  4. data/CHANGELOG.md +30 -0
  5. data/Gemfile.lock +35 -4
  6. data/README.md +169 -71
  7. data/Rakefile +29 -4
  8. data/docs/assets/images/ddq_architecture.svg +130 -0
  9. data/docs/assets/images/dlq_architecture.svg +115 -0
  10. data/docs/assets/images/enhanced-dual-publishing.svg +136 -0
  11. data/docs/assets/images/enhanced-fluent-api.svg +149 -0
  12. data/docs/assets/images/enhanced-microservices-routing.svg +115 -0
  13. data/docs/assets/images/enhanced-pattern-matching.svg +107 -0
  14. data/docs/assets/images/fluent-api-demo.svg +59 -0
  15. data/docs/assets/images/performance-comparison.svg +161 -0
  16. data/docs/assets/images/redis-basic-architecture.svg +53 -0
  17. data/docs/assets/images/redis-enhanced-architecture.svg +88 -0
  18. data/docs/assets/images/redis-queue-architecture.svg +101 -0
  19. data/docs/assets/images/smart_message.jpg +0 -0
  20. data/docs/assets/images/smart_message_walking.jpg +0 -0
  21. data/docs/assets/images/smartmessage_architecture_overview.svg +173 -0
  22. data/docs/assets/images/transport-comparison-matrix.svg +171 -0
  23. data/docs/assets/javascripts/mathjax.js +17 -0
  24. data/docs/assets/stylesheets/extra.css +51 -0
  25. data/docs/{addressing.md → core-concepts/addressing.md} +5 -7
  26. data/docs/{architecture.md → core-concepts/architecture.md} +78 -138
  27. data/docs/{dispatcher.md → core-concepts/dispatcher.md} +21 -21
  28. data/docs/{message_filtering.md → core-concepts/message-filtering.md} +2 -3
  29. data/docs/{message_processing.md → core-concepts/message-processing.md} +17 -17
  30. data/docs/{troubleshooting.md → development/troubleshooting.md} +7 -7
  31. data/docs/{examples.md → getting-started/examples.md} +115 -89
  32. data/docs/{getting-started.md → getting-started/quick-start.md} +47 -18
  33. data/docs/guides/redis-queue-getting-started.md +697 -0
  34. data/docs/guides/redis-queue-patterns.md +889 -0
  35. data/docs/guides/redis-queue-production.md +1091 -0
  36. data/docs/index.md +64 -0
  37. data/docs/{dead_letter_queue.md → reference/dead-letter-queue.md} +2 -3
  38. data/docs/{logging.md → reference/logging.md} +1 -1
  39. data/docs/{message_deduplication.md → reference/message-deduplication.md} +1 -0
  40. data/docs/{proc_handlers_summary.md → reference/proc-handlers.md} +7 -6
  41. data/docs/{serializers.md → reference/serializers.md} +3 -5
  42. data/docs/{transports.md → reference/transports.md} +133 -11
  43. data/docs/transports/memory-transport.md +374 -0
  44. data/docs/transports/redis-enhanced-transport.md +524 -0
  45. data/docs/transports/redis-queue-transport.md +1304 -0
  46. data/docs/transports/redis-transport-comparison.md +496 -0
  47. data/docs/transports/redis-transport.md +509 -0
  48. data/examples/README.md +98 -5
  49. data/examples/city_scenario/911_emergency_call_flow.svg +99 -0
  50. data/examples/city_scenario/README.md +515 -0
  51. data/examples/city_scenario/ai_visitor_intelligence_flow.svg +108 -0
  52. data/examples/city_scenario/citizen.rb +195 -0
  53. data/examples/city_scenario/city_diagram.svg +125 -0
  54. data/examples/city_scenario/common/health_monitor.rb +80 -0
  55. data/examples/city_scenario/common/logger.rb +30 -0
  56. data/examples/city_scenario/emergency_dispatch_center.rb +270 -0
  57. data/examples/city_scenario/fire_department.rb +446 -0
  58. data/examples/city_scenario/fire_emergency_flow.svg +95 -0
  59. data/examples/city_scenario/health_department.rb +100 -0
  60. data/examples/city_scenario/health_monitoring_system.svg +130 -0
  61. data/examples/city_scenario/house.rb +244 -0
  62. data/examples/city_scenario/local_bank.rb +217 -0
  63. data/examples/city_scenario/messages/emergency_911_message.rb +81 -0
  64. data/examples/city_scenario/messages/emergency_resolved_message.rb +43 -0
  65. data/examples/city_scenario/messages/fire_dispatch_message.rb +43 -0
  66. data/examples/city_scenario/messages/fire_emergency_message.rb +45 -0
  67. data/examples/city_scenario/messages/health_check_message.rb +22 -0
  68. data/examples/city_scenario/messages/health_status_message.rb +35 -0
  69. data/examples/city_scenario/messages/police_dispatch_message.rb +46 -0
  70. data/examples/city_scenario/messages/silent_alarm_message.rb +38 -0
  71. data/examples/city_scenario/police_department.rb +316 -0
  72. data/examples/city_scenario/redis_monitor.rb +129 -0
  73. data/examples/city_scenario/redis_stats.rb +743 -0
  74. data/examples/city_scenario/room_for_improvement.md +240 -0
  75. data/examples/city_scenario/security_emergency_flow.svg +95 -0
  76. data/examples/city_scenario/service_internal_architecture.svg +154 -0
  77. data/examples/city_scenario/smart_message_ai_agent.rb +364 -0
  78. data/examples/city_scenario/start_demo.sh +236 -0
  79. data/examples/city_scenario/stop_demo.sh +106 -0
  80. data/examples/city_scenario/visitor.rb +631 -0
  81. data/examples/{10_message_deduplication.rb → memory/01_message_deduplication_demo.rb} +1 -1
  82. data/examples/{09_dead_letter_queue_demo.rb → memory/02_dead_letter_queue_demo.rb} +13 -40
  83. data/examples/{01_point_to_point_orders.rb → memory/03_point_to_point_orders.rb} +1 -1
  84. data/examples/{02_publish_subscribe_events.rb → memory/04_publish_subscribe_events.rb} +2 -2
  85. data/examples/{03_many_to_many_chat.rb → memory/05_many_to_many_chat.rb} +4 -4
  86. data/examples/{show_me.rb → memory/06_pretty_print_demo.rb} +1 -1
  87. data/examples/{05_proc_handlers.rb → memory/07_proc_handlers_demo.rb} +2 -2
  88. data/examples/{06_custom_logger_example.rb → memory/08_custom_logger_demo.rb} +17 -14
  89. data/examples/{07_error_handling_scenarios.rb → memory/09_error_handling_demo.rb} +4 -4
  90. data/examples/{08_entity_addressing_basic.rb → memory/10_entity_addressing_basic.rb} +8 -8
  91. data/examples/{08_entity_addressing_with_filtering.rb → memory/11_entity_addressing_with_filtering.rb} +6 -6
  92. data/examples/{09_regex_filtering_microservices.rb → memory/12_regex_filtering_microservices.rb} +2 -2
  93. data/examples/{10_header_block_configuration.rb → memory/13_header_block_configuration.rb} +6 -6
  94. data/examples/{11_global_configuration_example.rb → memory/14_global_configuration_demo.rb} +19 -8
  95. data/examples/{show_logger.rb → memory/15_logger_demo.rb} +1 -1
  96. data/examples/memory/README.md +163 -0
  97. data/examples/memory/memory_transport_architecture.svg +90 -0
  98. data/examples/memory/point_to_point_pattern.svg +94 -0
  99. data/examples/memory/publish_subscribe_pattern.svg +125 -0
  100. data/examples/{04_redis_smart_home_iot.rb → redis/01_smart_home_iot_demo.rb} +5 -5
  101. data/examples/redis/README.md +230 -0
  102. data/examples/redis/alert_system_flow.svg +127 -0
  103. data/examples/redis/dashboard_status_flow.svg +107 -0
  104. data/examples/redis/device_command_flow.svg +113 -0
  105. data/examples/redis/redis_transport_architecture.svg +115 -0
  106. data/examples/{smart_home_iot_dataflow.md → redis/smart_home_iot_dataflow.md} +4 -116
  107. data/examples/redis/smart_home_system_architecture.svg +133 -0
  108. data/examples/redis_enhanced/README.md +319 -0
  109. data/examples/redis_enhanced/enhanced_01_basic_patterns.rb +233 -0
  110. data/examples/redis_enhanced/enhanced_02_fluent_api.rb +331 -0
  111. data/examples/redis_enhanced/enhanced_03_dual_publishing.rb +281 -0
  112. data/examples/redis_enhanced/enhanced_04_advanced_routing.rb +419 -0
  113. data/examples/redis_queue/01_basic_messaging.rb +221 -0
  114. data/examples/redis_queue/01_comprehensive_examples.rb +508 -0
  115. data/examples/redis_queue/02_pattern_routing.rb +405 -0
  116. data/examples/redis_queue/03_fluent_api.rb +422 -0
  117. data/examples/redis_queue/04_load_balancing.rb +486 -0
  118. data/examples/redis_queue/05_microservices.rb +735 -0
  119. data/examples/redis_queue/06_emergency_alerts.rb +777 -0
  120. data/examples/redis_queue/07_queue_management.rb +587 -0
  121. data/examples/redis_queue/README.md +366 -0
  122. data/examples/redis_queue/enhanced_01_basic_patterns.rb +233 -0
  123. data/examples/redis_queue/enhanced_02_fluent_api.rb +331 -0
  124. data/examples/redis_queue/enhanced_03_dual_publishing.rb +281 -0
  125. data/examples/redis_queue/enhanced_04_advanced_routing.rb +419 -0
  126. data/examples/redis_queue/redis_queue_architecture.svg +148 -0
  127. data/ideas/README.md +41 -0
  128. data/ideas/agents.md +1001 -0
  129. data/ideas/database_transport.md +980 -0
  130. data/ideas/improvement.md +359 -0
  131. data/ideas/meshage.md +1788 -0
  132. data/ideas/message_discovery.md +178 -0
  133. data/ideas/message_schema.md +1381 -0
  134. data/lib/smart_message/.idea/.gitignore +8 -0
  135. data/lib/smart_message/.idea/markdown.xml +6 -0
  136. data/lib/smart_message/.idea/misc.xml +4 -0
  137. data/lib/smart_message/.idea/modules.xml +8 -0
  138. data/lib/smart_message/.idea/smart_message.iml +16 -0
  139. data/lib/smart_message/.idea/vcs.xml +6 -0
  140. data/lib/smart_message/addressing.rb +15 -0
  141. data/lib/smart_message/base.rb +0 -2
  142. data/lib/smart_message/configuration.rb +1 -1
  143. data/lib/smart_message/logger.rb +15 -4
  144. data/lib/smart_message/plugins.rb +5 -2
  145. data/lib/smart_message/serializer.rb +14 -0
  146. data/lib/smart_message/transport/redis_enhanced_transport.rb +399 -0
  147. data/lib/smart_message/transport/redis_queue_transport.rb +555 -0
  148. data/lib/smart_message/transport/registry.rb +1 -0
  149. data/lib/smart_message/transport.rb +34 -1
  150. data/lib/smart_message/version.rb +1 -1
  151. data/lib/smart_message.rb +5 -52
  152. data/mkdocs.yml +184 -0
  153. data/p2p_plan.md +326 -0
  154. data/p2p_roadmap.md +287 -0
  155. data/smart_message.gemspec +2 -0
  156. data/smart_message.svg +51 -0
  157. metadata +170 -44
  158. data/docs/README.md +0 -57
  159. data/examples/dead_letters.jsonl +0 -12
  160. data/examples/temp.txt +0 -94
  161. data/examples/tmux_chat/README.md +0 -283
  162. data/examples/tmux_chat/bot_agent.rb +0 -278
  163. data/examples/tmux_chat/human_agent.rb +0 -199
  164. data/examples/tmux_chat/room_monitor.rb +0 -160
  165. data/examples/tmux_chat/shared_chat_system.rb +0 -328
  166. data/examples/tmux_chat/start_chat_demo.sh +0 -190
  167. data/examples/tmux_chat/stop_chat_demo.sh +0 -22
  168. /data/docs/{properties.md → core-concepts/properties.md} +0 -0
  169. /data/docs/{ideas_to_think_about.md → development/ideas.md} +0 -0
@@ -0,0 +1,163 @@
1
+ # Memory Transport Examples
2
+
3
+ This directory contains demonstration programs that use SmartMessage's **Memory Transport** and **Stdout Transport** (with loopback). These examples show the fundamentals of SmartMessage without requiring external dependencies like Redis or message queues.
4
+
5
+ ## Transport Overview
6
+
7
+ The Memory and Stdout (with loopback) transports are ideal for:
8
+ - **Learning SmartMessage fundamentals**
9
+ - **Rapid prototyping and testing**
10
+ - **Single-process applications**
11
+ - **Development and debugging**
12
+
13
+ These transports keep all message routing in-memory within the current Ruby process.
14
+
15
+ ## Example Programs
16
+
17
+ ### 📋 01_message_deduplication_demo.rb
18
+ **Demonstrates:** Message deduplication patterns
19
+ **Transport:** MemoryTransport
20
+ - Shows how to prevent duplicate message processing
21
+ - Implements deduplication based on message IDs
22
+ - Tracks processed messages to avoid reprocessing
23
+ - Useful for ensuring idempotent message handling
24
+
25
+ ### 🚨 02_dead_letter_queue_demo.rb
26
+ **Demonstrates:** Dead letter queue error handling
27
+ **Transport:** Custom failing transport (extends Base)
28
+ - Simulates transport failures and message retry logic
29
+ - Shows dead letter queue pattern implementation
30
+ - Handles various failure scenarios (connection errors, timeouts)
31
+ - Demonstrates message recovery and error reporting
32
+
33
+ ### 🛍️ 03_point_to_point_orders.rb
34
+ **Demonstrates:** Point-to-point messaging (1:1)
35
+ **Transport:** StdoutTransport with loopback
36
+ - Order processing system between OrderService and PaymentService
37
+ - Request/response message pattern
38
+ - JSON serialization of complex order data
39
+ - Bidirectional communication flow
40
+
41
+ ### 📢 04_publish_subscribe_events.rb
42
+ **Demonstrates:** Publish-subscribe messaging (1:many)
43
+ **Transport:** StdoutTransport with loopback
44
+ - User event notification system
45
+ - Multiple subscribers (EmailService, SMSService, AuditService)
46
+ - Event-driven architecture
47
+ - Different services handling same events differently
48
+
49
+ ### 💬 05_many_to_many_chat.rb
50
+ **Demonstrates:** Many-to-many messaging patterns
51
+ **Transport:** StdoutTransport with loopback
52
+ - Multi-user chat room system
53
+ - Message broadcasting to multiple participants
54
+ - User presence and room management
55
+ - Complex message routing scenarios
56
+
57
+ ### 🎨 06_pretty_print_demo.rb
58
+ **Demonstrates:** Message pretty-printing and debugging
59
+ **Transport:** None (utility demo)
60
+ - Shows SmartMessage's `pretty_print` method
61
+ - Formats complex nested message data
62
+ - Header and content display modes
63
+ - Useful for development and troubleshooting
64
+
65
+ ### ⚡ 07_proc_handlers_demo.rb
66
+ **Demonstrates:** Proc-based message handlers
67
+ **Transport:** StdoutTransport with loopback
68
+ - Custom Proc handlers for message processing
69
+ - Dynamic message routing
70
+ - Flexible handler assignment
71
+ - Lambda and block-based processors
72
+
73
+ ### 📊 08_custom_logger_demo.rb
74
+ **Demonstrates:** Custom logging implementations
75
+ **Transport:** StdoutTransport with loopback
76
+ - Multiple logger types and configurations
77
+ - Custom logger classes
78
+ - Log filtering and formatting
79
+ - Integration with external logging systems
80
+
81
+ ### ❌ 09_error_handling_demo.rb
82
+ **Demonstrates:** Error handling strategies
83
+ **Transport:** StdoutTransport with loopback
84
+ - Various error scenarios and recovery patterns
85
+ - Exception handling in message processors
86
+ - Error propagation and logging
87
+ - Graceful degradation techniques
88
+
89
+ ### 🎯 10_entity_addressing_basic.rb
90
+ **Demonstrates:** Basic entity addressing
91
+ **Transport:** StdoutTransport with loopback
92
+ - Message routing by entity addresses
93
+ - Order processing with specific routing
94
+ - Customer and payment entity handling
95
+ - Address-based message filtering
96
+
97
+ ### 🔍 11_entity_addressing_with_filtering.rb
98
+ **Demonstrates:** Advanced entity addressing with filters
99
+ **Transport:** StdoutTransport with loopback
100
+ - Complex filtering patterns
101
+ - Regex-based address matching
102
+ - Multiple entity types and routing rules
103
+ - Advanced subscription filtering
104
+
105
+ ### 🏢 12_regex_filtering_microservices.rb
106
+ **Demonstrates:** Microservices with regex filtering
107
+ **Transport:** StdoutTransport with loopback
108
+ - Service-to-service communication patterns
109
+ - Regular expression-based routing
110
+ - Environment-based filtering (dev/staging/prod)
111
+ - Microservices architecture simulation
112
+
113
+ ### 📝 13_header_block_configuration.rb
114
+ **Demonstrates:** Header configuration with blocks
115
+ **Transport:** StdoutTransport
116
+ - Dynamic header configuration
117
+ - Block-based header modification
118
+ - Custom header fields
119
+ - Header inheritance patterns
120
+
121
+ ### 🌍 14_global_configuration_demo.rb
122
+ **Demonstrates:** Global SmartMessage configuration
123
+ **Transport:** StdoutTransport with loopback
124
+ - Global transport and serializer settings
125
+ - Configuration inheritance
126
+ - Default settings management
127
+ - Application-wide configuration patterns
128
+
129
+ ### 📋 15_logger_demo.rb
130
+ **Demonstrates:** Logger configuration and usage
131
+ **Transport:** StdoutTransport
132
+ - Various logger configurations
133
+ - Log level management
134
+ - Custom log formatting
135
+ - Integration with SmartMessage lifecycle
136
+
137
+ ## Getting Started
138
+
139
+ To run any example:
140
+
141
+ ```bash
142
+ cd examples/memory
143
+ ruby 01_message_deduplication_demo.rb
144
+ ```
145
+
146
+ Most examples are self-contained and will demonstrate their concepts through console output.
147
+
148
+ ## Key Learning Points
149
+
150
+ 1. **In-Memory Processing**: All examples run within a single Ruby process
151
+ 2. **No External Dependencies**: No Redis, database, or message broker required
152
+ 3. **Immediate Feedback**: Console output shows message flow in real-time
153
+ 4. **Development Friendly**: Perfect for learning and experimentation
154
+ 5. **Pattern Foundation**: Concepts apply to all SmartMessage transports
155
+
156
+ ## Next Steps
157
+
158
+ After mastering these memory-based examples, explore:
159
+ - **[Redis Examples](../redis/)** - For distributed messaging
160
+ - **[Redis Queue Examples](../redis_queue/)** - For reliable message queuing
161
+ - **[Redis Enhanced Examples](../redis_enhanced/)** - For advanced Redis patterns
162
+
163
+ These memory examples provide the foundation for understanding SmartMessage's core concepts before moving to production-ready transports.
@@ -0,0 +1,90 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="800" height="600" viewBox="0 0 800 600" xmlns="http://www.w3.org/2000/svg">
3
+ <defs>
4
+ <style>
5
+ .bg { fill: transparent; }
6
+ .box { fill: #2a2a2a; stroke: #4a9eff; stroke-width: 2; rx: 8; }
7
+ .memory-box { fill: #1a3a1a; stroke: #4aff4a; stroke-width: 2; rx: 8; }
8
+ .arrow { stroke: #ffaa4a; stroke-width: 3; fill: none; marker-end: url(#arrowhead); }
9
+ .text { fill: #ffffff; font-family: 'Arial', sans-serif; font-size: 14px; }
10
+ .title { fill: #4a9eff; font-family: 'Arial', sans-serif; font-size: 18px; font-weight: bold; }
11
+ .subtitle { fill: #ffaa4a; font-family: 'Arial', sans-serif; font-size: 12px; }
12
+ .process { fill: #3a2a4a; stroke: #aa4aff; stroke-width: 2; rx: 6; }
13
+ </style>
14
+ <marker id="arrowhead" markerWidth="10" markerHeight="7"
15
+ refX="10" refY="3.5" orient="auto">
16
+ <polygon points="0 0, 10 3.5, 0 7" fill="#ffaa4a" />
17
+ </marker>
18
+ </defs>
19
+
20
+ <!-- Background -->
21
+ <rect class="bg" width="800" height="600"/>
22
+
23
+ <!-- Title -->
24
+ <text x="400" y="30" text-anchor="middle" class="title">SmartMessage Memory Transport Architecture</text>
25
+ <text x="400" y="50" text-anchor="middle" class="subtitle">Single Process - In-Memory Message Routing</text>
26
+
27
+ <!-- Ruby Process Container -->
28
+ <rect x="50" y="80" width="700" height="480" class="box"/>
29
+ <text x="70" y="105" class="text">Ruby Process (Single JVM/Interpreter)</text>
30
+
31
+ <!-- Publisher Components -->
32
+ <rect x="80" y="140" width="150" height="80" class="process"/>
33
+ <text x="155" y="165" text-anchor="middle" class="text">Order Service</text>
34
+ <text x="155" y="185" text-anchor="middle" class="subtitle">(Publisher)</text>
35
+ <text x="155" y="205" text-anchor="middle" class="subtitle">Creates Messages</text>
36
+
37
+ <rect x="80" y="250" width="150" height="80" class="process"/>
38
+ <text x="155" y="275" text-anchor="middle" class="text">User Manager</text>
39
+ <text x="155" y="295" text-anchor="middle" class="subtitle">(Publisher)</text>
40
+ <text x="155" y="315" text-anchor="middle" class="subtitle">Publishes Events</text>
41
+
42
+ <!-- Memory Transport Core -->
43
+ <rect x="300" y="180" width="200" height="120" class="memory-box"/>
44
+ <text x="400" y="205" text-anchor="middle" class="title">Memory Transport</text>
45
+ <text x="400" y="225" text-anchor="middle" class="text">In-Process Routing</text>
46
+ <text x="400" y="245" text-anchor="middle" class="subtitle">• Message Dispatcher</text>
47
+ <text x="400" y="265" text-anchor="middle" class="subtitle">• Thread Pool</text>
48
+ <text x="400" y="285" text-anchor="middle" class="subtitle">• Subscription Registry</text>
49
+
50
+ <!-- Subscriber Components -->
51
+ <rect x="570" y="140" width="150" height="80" class="process"/>
52
+ <text x="645" y="165" text-anchor="middle" class="text">Payment Service</text>
53
+ <text x="645" y="185" text-anchor="middle" class="subtitle">(Subscriber)</text>
54
+ <text x="645" y="205" text-anchor="middle" class="subtitle">Processes Orders</text>
55
+
56
+ <rect x="570" y="250" width="150" height="80" class="process"/>
57
+ <text x="645" y="275" text-anchor="middle" class="text">Email Service</text>
58
+ <text x="645" y="295" text-anchor="middle" class="subtitle">(Subscriber)</text>
59
+ <text x="645" y="315" text-anchor="middle" class="subtitle">Sends Notifications</text>
60
+
61
+ <rect x="570" y="360" width="150" height="80" class="process"/>
62
+ <text x="645" y="385" text-anchor="middle" class="text">Audit Service</text>
63
+ <text x="645" y="405" text-anchor="middle" class="subtitle">(Subscriber)</text>
64
+ <text x="645" y="425" text-anchor="middle" class="subtitle">Logs Events</text>
65
+
66
+ <!-- Message Flow Arrows -->
67
+ <!-- Publishers to Transport -->
68
+ <path d="M 230 180 L 300 220" class="arrow"/>
69
+ <path d="M 230 290 L 300 260" class="arrow"/>
70
+
71
+ <!-- Transport to Subscribers -->
72
+ <path d="M 500 220 L 570 180" class="arrow"/>
73
+ <path d="M 500 240 L 570 280" class="arrow"/>
74
+ <path d="M 500 260 L 570 380" class="arrow"/>
75
+
76
+ <!-- Key Features Box -->
77
+ <rect x="80" y="380" width="640" height="160" class="box"/>
78
+ <text x="100" y="405" class="title">Key Characteristics</text>
79
+
80
+ <text x="100" y="430" class="text">✓ Single Process: All components run in same Ruby process</text>
81
+ <text x="100" y="450" class="text">✓ No External Dependencies: No Redis, databases, or message brokers required</text>
82
+ <text x="100" y="470" class="text">✓ Immediate Routing: Messages routed instantly through in-memory dispatcher</text>
83
+ <text x="100" y="490" class="text">✓ Thread-Safe: Concurrent message processing with thread pool</text>
84
+ <text x="100" y="510" class="text">✓ Development Friendly: Perfect for learning, testing, and rapid prototyping</text>
85
+
86
+ <!-- Usage Note -->
87
+ <text x="400" y="580" text-anchor="middle" class="subtitle">
88
+ Ideal for: Development • Testing • Single-Process Applications • Learning SmartMessage Fundamentals
89
+ </text>
90
+ </svg>
@@ -0,0 +1,94 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="800" height="500" viewBox="0 0 800 500" xmlns="http://www.w3.org/2000/svg">
3
+ <defs>
4
+ <style>
5
+ .bg { fill: transparent; }
6
+ .service { fill: #2a2a2a; stroke: #4a9eff; stroke-width: 2; rx: 10; }
7
+ .message { fill: #4a2a4a; stroke: #ff4a9e; stroke-width: 2; rx: 6; }
8
+ .arrow { stroke: #ffaa4a; stroke-width: 3; fill: none; marker-end: url(#arrowhead); }
9
+ .arrow-response { stroke: #4aff4a; stroke-width: 3; fill: none; marker-end: url(#arrowhead-green); }
10
+ .text { fill: #ffffff; font-family: 'Arial', sans-serif; font-size: 14px; }
11
+ .title { fill: #4a9eff; font-family: 'Arial', sans-serif; font-size: 20px; font-weight: bold; }
12
+ .subtitle { fill: #ffaa4a; font-family: 'Arial', sans-serif; font-size: 12px; }
13
+ .step { fill: #ff4a9e; font-family: 'Arial', sans-serif; font-size: 13px; font-weight: bold; }
14
+ </style>
15
+ <marker id="arrowhead" markerWidth="10" markerHeight="7"
16
+ refX="10" refY="3.5" orient="auto">
17
+ <polygon points="0 0, 10 3.5, 0 7" fill="#ffaa4a" />
18
+ </marker>
19
+ <marker id="arrowhead-green" markerWidth="10" markerHeight="7"
20
+ refX="10" refY="3.5" orient="auto">
21
+ <polygon points="0 0, 10 3.5, 0 7" fill="#4aff4a" />
22
+ </marker>
23
+ </defs>
24
+
25
+ <!-- Background -->
26
+ <rect class="bg" width="800" height="500"/>
27
+
28
+ <!-- Title -->
29
+ <text x="400" y="30" text-anchor="middle" class="title">Point-to-Point Messaging Pattern</text>
30
+ <text x="400" y="50" text-anchor="middle" class="subtitle">Order Processing System Example (03_point_to_point_orders.rb)</text>
31
+
32
+ <!-- Order Service -->
33
+ <rect x="50" y="100" width="180" height="100" class="service"/>
34
+ <text x="140" y="130" text-anchor="middle" class="text">Order Service</text>
35
+ <text x="140" y="150" text-anchor="middle" class="subtitle">• Creates orders</text>
36
+ <text x="140" y="170" text-anchor="middle" class="subtitle">• Publishes OrderMessage</text>
37
+ <text x="140" y="190" text-anchor="middle" class="subtitle">• Receives PaymentResponse</text>
38
+
39
+ <!-- Payment Service -->
40
+ <rect x="570" y="100" width="180" height="100" class="service"/>
41
+ <text x="660" y="130" text-anchor="middle" class="text">Payment Service</text>
42
+ <text x="660" y="150" text-anchor="middle" class="subtitle">• Processes payments</text>
43
+ <text x="660" y="170" text-anchor="middle" class="subtitle">• Subscribes to OrderMessage</text>
44
+ <text x="660" y="190" text-anchor="middle" class="subtitle">• Sends PaymentResponse</text>
45
+
46
+ <!-- Message Flow -->
47
+ <!-- Step 1: Order Message -->
48
+ <rect x="280" y="120" width="240" height="60" class="message"/>
49
+ <text x="400" y="145" text-anchor="middle" class="step">1. OrderMessage</text>
50
+ <text x="400" y="165" text-anchor="middle" class="subtitle">order_id, amount, customer_id</text>
51
+
52
+ <path d="M 230 150 L 280 150" class="arrow"/>
53
+ <path d="M 520 150 L 570 150" class="arrow"/>
54
+
55
+ <!-- Step 2: Response Message -->
56
+ <rect x="280" y="260" width="240" height="60" class="message"/>
57
+ <text x="400" y="285" text-anchor="middle" class="step">2. PaymentResponseMessage</text>
58
+ <text x="400" y="305" text-anchor="middle" class="subtitle">payment_id, status, message</text>
59
+
60
+ <path d="M 520 290 L 570 290" class="arrow-response"/>
61
+ <path d="M 280 290 L 230 290" class="arrow-response"/>
62
+
63
+ <!-- Curved arrows for message flow -->
64
+ <path d="M 660 200 Q 400 240 140 200" stroke="#4aff4a" stroke-width="2" fill="none"
65
+ marker-end="url(#arrowhead-green)" stroke-dasharray="5,5"/>
66
+
67
+ <!-- Process Steps -->
68
+ <rect x="50" y="350" width="700" height="120" class="service"/>
69
+ <text x="70" y="375" class="title">Message Flow Process</text>
70
+
71
+ <circle cx="90" cy="400" r="15" fill="#ff4a9e"/>
72
+ <text x="90" y="405" text-anchor="middle" class="text">1</text>
73
+ <text x="115" y="405" class="text">OrderService creates order and publishes OrderMessage</text>
74
+
75
+ <circle cx="90" cy="425" r="15" fill="#ff4a9e"/>
76
+ <text x="90" y="430" text-anchor="middle" class="text">2</text>
77
+ <text x="115" y="430" class="text">Memory transport routes message to PaymentService subscriber</text>
78
+
79
+ <circle cx="90" cy="450" r="15" fill="#ff4a9e"/>
80
+ <text x="90" y="455" text-anchor="middle" class="text">3</text>
81
+ <text x="115" y="455" class="text">PaymentService processes payment and publishes PaymentResponseMessage</text>
82
+
83
+ <circle cx="400" cy="400" r="15" fill="#4aff4a"/>
84
+ <text x="400" y="405" text-anchor="middle" class="text">4</text>
85
+ <text x="425" y="405" class="text">Response message routed back to OrderService</text>
86
+
87
+ <circle cx="400" cy="425" r="15" fill="#4aff4a"/>
88
+ <text x="400" y="430" text-anchor="middle" class="text">5</text>
89
+ <text x="425" y="430" class="text">OrderService receives confirmation of payment status</text>
90
+
91
+ <circle cx="400" cy="450" r="15" fill="#4aff4a"/>
92
+ <text x="400" y="455" text-anchor="middle" class="text">6</text>
93
+ <text x="425" y="455" class="text">Complete request-response cycle with reliable delivery</text>
94
+ </svg>
@@ -0,0 +1,125 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="800" height="600" viewBox="0 0 800 600" xmlns="http://www.w3.org/2000/svg">
3
+ <defs>
4
+ <style>
5
+ .bg { fill: transparent; }
6
+ .publisher { fill: #3a2a1a; stroke: #ffaa4a; stroke-width: 2; rx: 10; }
7
+ .subscriber { fill: #1a2a3a; stroke: #4a9eff; stroke-width: 2; rx: 8; }
8
+ .dispatcher { fill: #2a3a2a; stroke: #4aff4a; stroke-width: 3; rx: 12; }
9
+ .event { fill: #4a1a2a; stroke: #ff4aaa; stroke-width: 2; rx: 6; }
10
+ .arrow { stroke: #ffaa4a; stroke-width: 2; fill: none; marker-end: url(#arrowhead); }
11
+ .fan-arrow { stroke: #4aff4a; stroke-width: 2; fill: none; marker-end: url(#fan-arrowhead); }
12
+ .text { fill: #ffffff; font-family: 'Arial', sans-serif; font-size: 12px; }
13
+ .title { fill: #4a9eff; font-family: 'Arial', sans-serif; font-size: 18px; font-weight: bold; }
14
+ .subtitle { fill: #ffaa4a; font-family: 'Arial', sans-serif; font-size: 11px; }
15
+ .event-text { fill: #ff4aaa; font-family: 'Arial', sans-serif; font-size: 11px; }
16
+ </style>
17
+ <marker id="arrowhead" markerWidth="8" markerHeight="6"
18
+ refX="8" refY="3" orient="auto">
19
+ <polygon points="0 0, 8 3, 0 6" fill="#ffaa4a" />
20
+ </marker>
21
+ <marker id="fan-arrowhead" markerWidth="8" markerHeight="6"
22
+ refX="8" refY="3" orient="auto">
23
+ <polygon points="0 0, 8 3, 0 6" fill="#4aff4a" />
24
+ </marker>
25
+ </defs>
26
+
27
+ <!-- Background -->
28
+ <rect class="bg" width="800" height="600"/>
29
+
30
+ <!-- Title -->
31
+ <text x="400" y="25" text-anchor="middle" class="title">Publish-Subscribe Pattern (1-to-Many)</text>
32
+ <text x="400" y="45" text-anchor="middle" class="subtitle">User Event Notification System (04_publish_subscribe_events.rb)</text>
33
+
34
+ <!-- Publisher -->
35
+ <rect x="50" y="280" width="180" height="80" class="publisher"/>
36
+ <text x="140" y="305" text-anchor="middle" class="title">User Manager</text>
37
+ <text x="140" y="325" text-anchor="middle" class="subtitle">(Publisher)</text>
38
+ <text x="140" y="345" text-anchor="middle" class="text">• User registration</text>
39
+ <text x="140" y="360" text-anchor="middle" class="text">• Password changes</text>
40
+
41
+ <!-- Memory Dispatcher -->
42
+ <rect x="320" y="270" width="160" height="100" class="dispatcher"/>
43
+ <text x="400" y="295" text-anchor="middle" class="title">Memory</text>
44
+ <text x="400" y="315" text-anchor="middle" class="title">Dispatcher</text>
45
+ <text x="400" y="335" text-anchor="middle" class="text">Message Router</text>
46
+ <text x="400" y="355" text-anchor="middle" class="subtitle">Thread Pool</text>
47
+
48
+ <!-- Event Message -->
49
+ <rect x="300" y="120" width="200" height="60" class="event"/>
50
+ <text x="400" y="145" text-anchor="middle" class="event-text">UserEventMessage</text>
51
+ <text x="400" y="165" text-anchor="middle" class="subtitle">event_type: "user_registered"</text>
52
+
53
+ <!-- Subscribers -->
54
+ <rect x="570" y="150" width="180" height="80" class="subscriber"/>
55
+ <text x="660" y="175" text-anchor="middle" class="title">Email Service</text>
56
+ <text x="660" y="195" text-anchor="middle" class="subtitle">(Subscriber)</text>
57
+ <text x="660" y="215" text-anchor="middle" class="text">• Welcome emails</text>
58
+ <text x="660" y="230" text-anchor="middle" class="text">• Security alerts</text>
59
+
60
+ <rect x="570" y="280" width="180" height="80" class="subscriber"/>
61
+ <text x="660" y="305" text-anchor="middle" class="title">SMS Service</text>
62
+ <text x="660" y="325" text-anchor="middle" class="subtitle">(Subscriber)</text>
63
+ <text x="660" y="345" text-anchor="middle" class="text">• Security SMS</text>
64
+ <text x="660" y="360" text-anchor="middle" class="text">• Login alerts</text>
65
+
66
+ <rect x="570" y="410" width="180" height="80" class="subscriber"/>
67
+ <text x="660" y="435" text-anchor="middle" class="title">Audit Service</text>
68
+ <text x="660" y="455" text-anchor="middle" class="subtitle">(Subscriber)</text>
69
+ <text x="660" y="475" text-anchor="middle" class="text">• Event logging</text>
70
+ <text x="660" y="490" text-anchor="middle" class="text">• Activity tracking</text>
71
+
72
+ <!-- Message Flow -->
73
+ <!-- Publisher to Dispatcher -->
74
+ <path d="M 230 320 L 320 320" class="arrow"/>
75
+
76
+ <!-- Event flow -->
77
+ <path d="M 230 300 L 350 180" class="arrow"/>
78
+
79
+ <!-- Dispatcher to Subscribers (Fan-out) -->
80
+ <path d="M 480 300 L 570 190" class="fan-arrow"/>
81
+ <path d="M 480 320 L 570 320" class="fan-arrow"/>
82
+ <path d="M 480 340 L 570 450" class="fan-arrow"/>
83
+
84
+ <!-- Event Types Examples -->
85
+ <rect x="50" y="400" width="480" height="180" class="dispatcher"/>
86
+ <text x="70" y="425" class="title">Event Processing Examples</text>
87
+
88
+ <!-- User Registration Event -->
89
+ <rect x="70" y="440" width="140" height="60" class="event"/>
90
+ <text x="140" y="460" text-anchor="middle" class="event-text">user_registered</text>
91
+ <text x="140" y="480" text-anchor="middle" class="subtitle">→ Welcome email</text>
92
+ <text x="140" y="495" text-anchor="middle" class="subtitle">→ Audit log</text>
93
+
94
+ <!-- Password Change Event -->
95
+ <rect x="230" y="440" width="140" height="60" class="event"/>
96
+ <text x="300" y="460" text-anchor="middle" class="event-text">password_changed</text>
97
+ <text x="300" y="480" text-anchor="middle" class="subtitle">→ Security email</text>
98
+ <text x="300" y="495" text-anchor="middle" class="subtitle">→ Security SMS</text>
99
+
100
+ <!-- Login Event -->
101
+ <rect x="390" y="440" width="140" height="60" class="event"/>
102
+ <text x="460" y="460" text-anchor="middle" class="event-text">suspicious_login</text>
103
+ <text x="460" y="480" text-anchor="middle" class="subtitle">→ Login alert SMS</text>
104
+ <text x="460" y="495" text-anchor="middle" class="subtitle">→ Audit log</text>
105
+
106
+ <!-- Processing Flow -->
107
+ <text x="70" y="530" class="title">Message Processing Flow:</text>
108
+
109
+ <circle cx="90" cy="550" r="12" fill="#ffaa4a"/>
110
+ <text x="90" y="555" text-anchor="middle" class="text">1</text>
111
+ <text x="110" y="555" class="text">UserManager publishes event to all subscribers</text>
112
+
113
+ <circle cx="350" cy="550" r="12" fill="#4aff4a"/>
114
+ <text x="350" y="555" text-anchor="middle" class="text">2</text>
115
+ <text x="370" y="555" class="text">Memory Dispatcher routes to all registered subscribers</text>
116
+
117
+ <circle cx="90" cy="570" r="12" fill="#4a9eff"/>
118
+ <text x="90" y="575" text-anchor="middle" class="text">3</text>
119
+ <text x="110" y="575" class="text">Each service processes event according to its business logic</text>
120
+
121
+ <!-- Pattern Benefits -->
122
+ <text x="570" y="530" class="title">Pattern Benefits:</text>
123
+ <text x="590" y="550" class="text">✓ Loose Coupling</text>
124
+ <text x="590" y="570" class="text">✓ Scalable Architecture</text>
125
+ </svg>
@@ -8,7 +8,7 @@
8
8
  # through Redis channels. Each message type gets its own Redis channel for
9
9
  # efficient routing and scaling.
10
10
 
11
- require_relative '../lib/smart_message'
11
+ require_relative '../../lib/smart_message'
12
12
 
13
13
  begin
14
14
  require 'redis'
@@ -79,7 +79,7 @@ class SensorDataMessage < SmartMessage::Base
79
79
 
80
80
  config do
81
81
  transport SHARED_TRANSPORT
82
- serializer SmartMessage::Serializer::JSON.new
82
+ serializer SmartMessage::Serializer::Json.new
83
83
  end
84
84
 
85
85
  def self.process(wrapper)
@@ -114,7 +114,7 @@ class DeviceCommandMessage < SmartMessage::Base
114
114
 
115
115
  config do
116
116
  transport SHARED_TRANSPORT
117
- serializer SmartMessage::Serializer::JSON.new
117
+ serializer SmartMessage::Serializer::Json.new
118
118
  end
119
119
 
120
120
  def self.process(wrapper)
@@ -147,7 +147,7 @@ class AlertMessage < SmartMessage::Base
147
147
 
148
148
  config do
149
149
  transport SHARED_TRANSPORT
150
- serializer SmartMessage::Serializer::JSON.new
150
+ serializer SmartMessage::Serializer::Json.new
151
151
  end
152
152
 
153
153
  def self.process(wrapper)
@@ -176,7 +176,7 @@ class DashboardStatusMessage < SmartMessage::Base
176
176
 
177
177
  config do
178
178
  transport SHARED_TRANSPORT
179
- serializer SmartMessage::Serializer::JSON.new
179
+ serializer SmartMessage::Serializer::Json.new
180
180
  end
181
181
 
182
182
  def self.process(wrapper)