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
@@ -20,12 +20,11 @@ class NotificationMessage < SmartMessage::Base
20
20
 
21
21
  config do
22
22
  transport SmartMessage::Transport.create(:stdout, loopback: true)
23
- serializer SmartMessage::Serializer::JSON.new
23
+ serializer SmartMessage::Serializer::Json.new
24
24
  end
25
25
 
26
- def self.process(message_header, message_payload)
27
- data = JSON.parse(message_payload)
28
- notification = new(data)
26
+ def self.process(decoded_message)
27
+ notification = decoded_message
29
28
 
30
29
  case notification.channel
31
30
  when 'email'
@@ -88,12 +87,11 @@ class UserRegisteredEvent < SmartMessage::Base
88
87
 
89
88
  config do
90
89
  transport SmartMessage::Transport.create(:memory, auto_process: true)
91
- serializer SmartMessage::Serializer::JSON.new
90
+ serializer SmartMessage::Serializer::Json.new
92
91
  end
93
92
 
94
- def self.process(message_header, message_payload)
95
- data = JSON.parse(message_payload)
96
- event = new(data)
93
+ def self.process(decoded_message)
94
+ event = decoded_message
97
95
 
98
96
  # Fan out to multiple handlers
99
97
  send_welcome_email(event)
@@ -154,12 +152,12 @@ class WelcomeEmailMessage < SmartMessage::Base
154
152
 
155
153
  config do
156
154
  transport SmartMessage::Transport.create(:stdout)
157
- serializer SmartMessage::Serializer::JSON.new
155
+ serializer SmartMessage::Serializer::Json.new
158
156
  end
159
157
 
160
- def self.process(message_header, message_payload)
161
- data = JSON.parse(message_payload)
162
- message = new(data)
158
+ def self.process(decoded_message)
159
+ # decoded_message is already a message instance
160
+ message = decoded_message
163
161
 
164
162
  puts "📧 Sending welcome email to #{message.email} (#{message.name})"
165
163
  # Email sending logic here
@@ -173,12 +171,12 @@ class AnalyticsMessage < SmartMessage::Base
173
171
 
174
172
  config do
175
173
  transport SmartMessage::Transport.create(:stdout)
176
- serializer SmartMessage::Serializer::JSON.new
174
+ serializer SmartMessage::Serializer::Json.new
177
175
  end
178
176
 
179
- def self.process(message_header, message_payload)
180
- data = JSON.parse(message_payload)
181
- event = new(data)
177
+ def self.process(decoded_message)
178
+ # decoded_message is already a message instance
179
+ event = decoded_message
182
180
 
183
181
  puts "📊 Tracking event: #{event.event_type} for user #{event.user_id}"
184
182
  # Analytics tracking logic here
@@ -211,12 +209,12 @@ class OrderCreatedMessage < SmartMessage::Base
211
209
 
212
210
  config do
213
211
  transport SmartMessage::Transport.create(:memory, auto_process: true)
214
- serializer SmartMessage::Serializer::JSON.new
212
+ serializer SmartMessage::Serializer::Json.new
215
213
  end
216
214
 
217
- def self.process(message_header, message_payload)
218
- data = JSON.parse(message_payload)
219
- order = new(data)
215
+ def self.process(decoded_message)
216
+ # decoded_message is already a message instance
217
+ order = decoded_message
220
218
 
221
219
  # Validate order
222
220
  if valid_order?(order)
@@ -254,12 +252,12 @@ class InventoryReservationMessage < SmartMessage::Base
254
252
 
255
253
  config do
256
254
  transport SmartMessage::Transport.create(:memory, auto_process: true)
257
- serializer SmartMessage::Serializer::JSON.new
255
+ serializer SmartMessage::Serializer::Json.new
258
256
  end
259
257
 
260
- def self.process(message_header, message_payload)
261
- data = JSON.parse(message_payload)
262
- reservation = new(data)
258
+ def self.process(decoded_message)
259
+ # decoded_message is already a message instance
260
+ reservation = decoded_message
263
261
 
264
262
  success = reserve_inventory(reservation.items)
265
263
 
@@ -291,12 +289,12 @@ class PaymentProcessingMessage < SmartMessage::Base
291
289
 
292
290
  config do
293
291
  transport SmartMessage::Transport.create(:memory, auto_process: true)
294
- serializer SmartMessage::Serializer::JSON.new
292
+ serializer SmartMessage::Serializer::Json.new
295
293
  end
296
294
 
297
- def self.process(message_header, message_payload)
298
- data = JSON.parse(message_payload)
299
- payment = new(data)
295
+ def self.process(decoded_message)
296
+ # decoded_message is already a message instance
297
+ payment = decoded_message
300
298
 
301
299
  success = process_payment(payment)
302
300
 
@@ -364,12 +362,12 @@ class LogMessage < SmartMessage::Base
364
362
 
365
363
  config do
366
364
  transport SmartMessage::Transport.create(:stdout, output: "application.log")
367
- serializer SmartMessage::Serializer::JSON.new
365
+ serializer SmartMessage::Serializer::Json.new
368
366
  end
369
367
 
370
- def self.process(message_header, message_payload)
371
- data = JSON.parse(message_payload)
372
- log_entry = new(data)
368
+ def self.process(decoded_message)
369
+ # decoded_message is already a message instance
370
+ log_entry = decoded_message
373
371
 
374
372
  formatted_message = format_log_entry(log_entry)
375
373
 
@@ -414,12 +412,12 @@ class MetricMessage < SmartMessage::Base
414
412
 
415
413
  config do
416
414
  transport SmartMessage::Transport.create(:memory, auto_process: true)
417
- serializer SmartMessage::Serializer::JSON.new
415
+ serializer SmartMessage::Serializer::Json.new
418
416
  end
419
417
 
420
- def self.process(message_header, message_payload)
421
- data = JSON.parse(message_payload)
422
- metric = new(data)
418
+ def self.process(decoded_message)
419
+ # decoded_message is already a message instance
420
+ metric = decoded_message
423
421
 
424
422
  # Store metric (would typically go to monitoring system)
425
423
  store_metric(metric)
@@ -498,12 +496,12 @@ class MessageGateway < SmartMessage::Base
498
496
  # Receive from one transport
499
497
  config do
500
498
  transport SmartMessage::Transport.create(:memory, auto_process: true)
501
- serializer SmartMessage::Serializer::JSON.new
499
+ serializer SmartMessage::Serializer::Json.new
502
500
  end
503
501
 
504
- def self.process(message_header, message_payload)
505
- data = JSON.parse(message_payload)
506
- gateway_message = new(data)
502
+ def self.process(decoded_message)
503
+ # decoded_message is already a message instance
504
+ gateway_message = decoded_message
507
505
 
508
506
  # Transform and forward to destination system
509
507
  case gateway_message.destination_system
@@ -567,8 +565,8 @@ class EmailSystemMessage < SmartMessage::Base
567
565
  property :original_payload
568
566
  property :source
569
567
 
570
- def self.process(message_header, message_payload)
571
- puts "📧 Email system processed message from #{JSON.parse(message_payload)['source']}"
568
+ def self.process(decoded_message)
569
+ puts "📧 Email system processed message from #{decoded_message.source}"
572
570
  end
573
571
  end
574
572
 
@@ -576,8 +574,8 @@ class SMSSystemMessage < SmartMessage::Base
576
574
  property :original_payload
577
575
  property :source
578
576
 
579
- def self.process(message_header, message_payload)
580
- puts "📱 SMS system processed message from #{JSON.parse(message_payload)['source']}"
577
+ def self.process(decoded_message)
578
+ puts "📱 SMS system processed message from #{decoded_message.source}"
581
579
  end
582
580
  end
583
581
 
@@ -587,8 +585,8 @@ class AuditSystemMessage < SmartMessage::Base
587
585
  property :source_system
588
586
  property :processed_at
589
587
 
590
- def self.process(message_header, message_payload)
591
- puts "📋 Audit system logged event from #{JSON.parse(message_payload)['source_system']}"
588
+ def self.process(decoded_message)
589
+ puts "📋 Audit system logged event from #{decoded_message.source_system}"
592
590
  end
593
591
  end
594
592
 
@@ -623,12 +621,12 @@ class ResilientMessage < SmartMessage::Base
623
621
 
624
622
  config do
625
623
  transport SmartMessage::Transport.create(:memory, auto_process: true)
626
- serializer SmartMessage::Serializer::JSON.new
624
+ serializer SmartMessage::Serializer::Json.new
627
625
  end
628
626
 
629
- def self.process(message_header, message_payload)
630
- data = JSON.parse(message_payload)
631
- message = new(data)
627
+ def self.process(decoded_message)
628
+ # decoded_message is already a message instance
629
+ message = decoded_message
632
630
 
633
631
  begin
634
632
  # Simulate potentially failing operation
@@ -691,12 +689,12 @@ class DeadLetterMessage < SmartMessage::Base
691
689
 
692
690
  config do
693
691
  transport SmartMessage::Transport.create(:stdout, output: "dead_letter_queue.log")
694
- serializer SmartMessage::Serializer::JSON.new
692
+ serializer SmartMessage::Serializer::Json.new
695
693
  end
696
694
 
697
- def self.process(message_header, message_payload)
698
- data = JSON.parse(message_payload)
699
- dead_letter = new(data)
695
+ def self.process(decoded_message)
696
+ # decoded_message is already a message instance
697
+ dead_letter = decoded_message
700
698
 
701
699
  puts "💀 Message sent to dead letter queue:"
702
700
  puts " Original: #{dead_letter.original_message}"
@@ -796,9 +794,9 @@ end
796
794
  class TestMessage < SmartMessage::Base
797
795
  property :data
798
796
 
799
- def self.process(message_header, message_payload)
800
- data = JSON.parse(message_payload)
801
- message = new(data)
797
+ def self.process(decoded_message)
798
+ # decoded_message is already a message instance
799
+ message = decoded_message
802
800
  puts "Processed test message: #{message.data}"
803
801
  end
804
802
  end
@@ -813,22 +811,46 @@ These examples demonstrate the flexibility and power of SmartMessage for buildin
813
811
 
814
812
  The `examples/` directory contains complete, runnable programs that demonstrate various SmartMessage features:
815
813
 
816
- ### Core Messaging Patterns
817
- - **`01_point_to_point_orders.rb`** - Point-to-point order processing with payment integration
818
- - **`02_publish_subscribe_events.rb`** - Event broadcasting to multiple services (email, SMS, audit)
819
- - **`03_many_to_many_chat.rb`** - Interactive chat system with rooms, bots, and human agents
820
-
821
- ### Advanced Features
822
- - **`04_redis_smart_home_iot.rb`** - Redis-based IoT sensor monitoring with real-time data flow
823
- - **`05_proc_handlers.rb`** - Flexible message handlers (blocks, procs, lambdas, methods)
824
- - **`06_custom_logger_example.rb`** - Advanced logging with SmartMessage::Logger::Default
825
- - **`07_error_handling_scenarios.rb`** - Comprehensive validation, version mismatch, and error handling
826
- - **`08_entity_addressing_basic.rb`** - Basic FROM/TO/REPLY_TO message addressing
827
- - **`08_entity_addressing_with_filtering.rb`** - Advanced entity-aware message filtering
828
- - **`09_dead_letter_queue_demo.rb`** - Complete Dead Letter Queue system demonstration
829
-
830
- ### Interactive Demos
831
- - **`tmux_chat/`** - Multi-pane terminal visualization of many-to-many messaging with file-based transport
814
+ ### Memory Transport Examples
815
+ - **`memory/03_point_to_point_orders.rb`** - Point-to-point order processing with payment integration
816
+ - **`memory/04_publish_subscribe_events.rb`** - Event broadcasting to multiple services (email, SMS, audit)
817
+ - **`memory/05_many_to_many_chat.rb`** - Interactive chat system with rooms, bots, and human agents
818
+ - **`memory/07_proc_handlers_demo.rb`** - Flexible message handlers (blocks, procs, lambdas, methods)
819
+ - **`memory/08_custom_logger_demo.rb`** - Advanced logging with SmartMessage::Logger::Default
820
+ - **`memory/09_error_handling_demo.rb`** - Comprehensive validation, version mismatch, and error handling
821
+ - **`memory/10_entity_addressing_basic.rb`** - Basic FROM/TO/REPLY_TO message addressing
822
+ - **`memory/11_entity_addressing_with_filtering.rb`** - Advanced entity-aware message filtering
823
+ - **`memory/02_dead_letter_queue_demo.rb`** - Complete Dead Letter Queue system demonstration
824
+ - **`memory/01_message_deduplication_demo.rb`** - Message deduplication patterns
825
+ - **`memory/12_regex_filtering_microservices.rb`** - Advanced regex filtering for microservices
826
+ - **`memory/13_header_block_configuration.rb`** - Header and block configuration examples
827
+ - **`memory/14_global_configuration_demo.rb`** - Global configuration management
828
+ - **`memory/15_logger_demo.rb`** - Advanced logging demonstrations
829
+
830
+ ### Redis Transport Examples
831
+ - **`redis/01_smart_home_iot_demo.rb`** - Redis-based IoT sensor monitoring with real-time data flow
832
+
833
+ ### Redis Enhanced Transport Examples
834
+ - **`redis_enhanced/enhanced_01_basic_patterns.rb`** - Basic enhanced transport patterns
835
+ - **`redis_enhanced/enhanced_02_fluent_api.rb`** - Fluent API usage examples
836
+ - **`redis_enhanced/enhanced_03_dual_publishing.rb`** - Dual publishing strategies
837
+ - **`redis_enhanced/enhanced_04_advanced_routing.rb`** - Advanced message routing
838
+
839
+ ### Redis Queue Transport Examples
840
+ - **`redis_queue/01_basic_messaging.rb`** - Basic queue messaging patterns
841
+ - **`redis_queue/02_pattern_routing.rb`** - Pattern-based message routing
842
+ - **`redis_queue/03_fluent_api.rb`** - Fluent API for queue operations
843
+ - **`redis_queue/04_load_balancing.rb`** - Load balancing across workers
844
+ - **`redis_queue/05_microservices.rb`** - Microservices communication
845
+ - **`redis_queue/06_emergency_alerts.rb`** - Emergency alert system
846
+ - **`redis_queue/07_queue_management.rb`** - Queue management utilities
847
+ - **`redis_queue/01_comprehensive_examples.rb`** - Comprehensive feature demonstration
848
+
849
+ ### City Scenario (Comprehensive Demo)
850
+ - **`city_scenario/`** - Complete emergency services simulation with multiple services and AI integration
851
+
852
+ ### Performance Testing
853
+ - **`performance_metrics/`** - Benchmarking tools and performance comparisons
832
854
 
833
855
  ### Running Examples
834
856
 
@@ -836,12 +858,14 @@ The `examples/` directory contains complete, runnable programs that demonstrate
836
858
  # Navigate to the SmartMessage directory
837
859
  cd smart_message
838
860
 
839
- # Run any example directly
840
- ruby examples/01_point_to_point_orders.rb
841
- ruby examples/09_dead_letter_queue_demo.rb
861
+ # Run examples from their respective transport directories
862
+ ruby examples/memory/03_point_to_point_orders.rb
863
+ ruby examples/memory/02_dead_letter_queue_demo.rb
864
+ ruby examples/redis/01_smart_home_iot_demo.rb
865
+ ruby examples/redis_queue/01_basic_messaging.rb
842
866
 
843
- # For tmux chat demo
844
- cd examples/tmux_chat && ./run_demo.sh
867
+ # For city scenario comprehensive demo
868
+ cd examples/city_scenario && ./start_demo.sh
845
869
  ```
846
870
 
847
871
  Each example is self-contained and includes:
@@ -853,16 +877,18 @@ Each example is self-contained and includes:
853
877
 
854
878
  ### Example Features Demonstrated
855
879
 
856
- | Example | Transports | Features | Use Case |
857
- |---------|------------|----------|----------|
858
- | 01 | STDOUT | Point-to-point, validation | Order processing |
859
- | 02 | STDOUT | Pub-sub, multiple handlers | Event broadcasting |
860
- | 03 | Memory | Many-to-many, bots | Chat systems |
861
- | 04 | Redis | IoT, real-time, addressing | Smart home monitoring |
862
- | 05 | Memory | Proc handlers, flexibility | Dynamic message handling |
863
- | 06 | STDOUT | Custom logging, lifecycle | Production logging |
864
- | 07 | STDOUT | Error handling, validation | Robust message systems |
865
- | 08 | STDOUT | Entity addressing, filtering | Microservice communication |
866
- | 09 | Memory | DLQ, circuit breakers, replay | Production reliability |
880
+ | Example | Transport | Features | Use Case |
881
+ |---------|-----------|----------|----------|
882
+ | memory/03 | Memory/STDOUT | Point-to-point, validation | Order processing |
883
+ | memory/04 | Memory/STDOUT | Pub-sub, multiple handlers | Event broadcasting |
884
+ | memory/05 | Memory | Many-to-many, bots | Chat systems |
885
+ | redis/01 | Redis | IoT, real-time, addressing | Smart home monitoring |
886
+ | memory/07 | Memory | Proc handlers, flexibility | Dynamic message handling |
887
+ | memory/08 | Memory/STDOUT | Custom logging, lifecycle | Production logging |
888
+ | memory/09 | Memory/STDOUT | Error handling, validation | Robust message systems |
889
+ | memory/10-11 | Memory/STDOUT | Entity addressing, filtering | Microservice communication |
890
+ | memory/02 | Memory | DLQ, circuit breakers, replay | Production reliability |
891
+ | redis_queue/* | Redis Queue | Load balancing, persistence | Production messaging |
892
+ | city_scenario/* | Redis | AI integration, health monitoring | Emergency services |
867
893
 
868
894
  These examples provide practical, working code that you can use as a starting point for your own SmartMessage implementations.
@@ -1,3 +1,4 @@
1
+
1
2
  # Getting Started with SmartMessage
2
3
 
3
4
  This guide will help you get up and running with SmartMessage quickly.
@@ -25,7 +26,38 @@ gem install smart_message
25
26
  ## Requirements
26
27
 
27
28
  - Ruby >= 3.0.0
28
- - No additional system dependencies
29
+ - No additional system dependencies for basic usage
30
+
31
+ ## Transport Options
32
+
33
+ SmartMessage supports multiple transport layers:
34
+
35
+ ### Built-in Transports
36
+
37
+ - **Memory Transport** - Perfect for development and testing. No external dependencies required.
38
+ - **STDOUT Transport** - Great for debugging and logging. No external dependencies.
39
+ - **Redis Transport** - Production-ready transport for distributed systems. Requires Redis server.
40
+
41
+ ### Redis Installation (Optional)
42
+
43
+ The Redis transport is built-in but requires Redis server to be installed. However, **you don't need Redis just to play around** - the Memory transport works great for development and testing.
44
+
45
+ If you want to use Redis transport:
46
+
47
+ **macOS:**
48
+ ```bash
49
+ brew install redis
50
+ brew services start redis
51
+ ```
52
+
53
+ **Ubuntu/Debian:**
54
+ ```bash
55
+ sudo apt-get update
56
+ sudo apt-get install redis-server
57
+ ```
58
+
59
+ **Other Transports:**
60
+ Additional transport layers (RabbitMQ, Kafka, etc.) are available as separate plugin repositories. Check the [Transports documentation](../reference/transports.md) for more information.
29
61
 
30
62
  ## Your First Message
31
63
 
@@ -60,14 +92,13 @@ class WelcomeMessage < SmartMessage::Base
60
92
  # Configure the transport (where messages go)
61
93
  config do
62
94
  transport SmartMessage::Transport.create(:stdout, loopback: true)
63
- serializer SmartMessage::Serializer::JSON.new
95
+ serializer SmartMessage::Serializer::Json.new
64
96
  end
65
97
 
66
98
  # Define how to process received messages
67
- def self.process(message_header, message_payload)
68
- # Decode the message
69
- data = JSON.parse(message_payload)
70
- welcome = new(data)
99
+ def self.process(decoded_message)
100
+ # decoded_message is already a message instance
101
+ welcome = decoded_message
71
102
 
72
103
  # Process the welcome message
73
104
  puts "🎉 Welcome #{welcome.user_name}!"
@@ -186,7 +217,7 @@ Serializers handle message encoding/decoding:
186
217
 
187
218
  ```ruby
188
219
  # JSON serialization (built-in)
189
- serializer SmartMessage::Serializer::JSON.new
220
+ serializer SmartMessage::Serializer::Json.new
190
221
  ```
191
222
 
192
223
  ### Message Handlers
@@ -265,16 +296,15 @@ payment.to('backup-gateway') # Override destination
265
296
  payment.publish
266
297
  ```
267
298
 
268
- For more details, see [Entity Addressing](addressing.md).
299
+ For more details, see [Entity Addressing](../core-concepts/addressing.md).
269
300
 
270
301
  ## Next Steps
271
302
 
272
303
  Now that you have the basics working, explore:
273
304
 
274
- - [Architecture Overview](architecture.md) - Understand how SmartMessage works
305
+ - [Architecture Overview](../core-concepts/architecture.md) - Understand how SmartMessage works
275
306
  - [Examples](examples.md) - See more practical use cases
276
- - [Transports](transports.md) - Learn about different transport options
277
- - [Custom Transports](custom-transports.md) - Build your own transport
307
+ - [Transports](../reference/transports.md) - Learn about different transport options
278
308
 
279
309
  ## Common Patterns
280
310
 
@@ -291,12 +321,12 @@ class NotificationMessage < SmartMessage::Base
291
321
 
292
322
  config do
293
323
  transport SmartMessage::Transport.create(:memory, auto_process: true)
294
- serializer SmartMessage::Serializer::JSON.new
324
+ serializer SmartMessage::Serializer::Json.new
295
325
  end
296
326
 
297
- def self.process(message_header, message_payload)
298
- data = JSON.parse(message_payload)
299
- notification = new(data)
327
+ def self.process(decoded_message)
328
+ # decoded_message is already a message instance
329
+ notification = decoded_message
300
330
 
301
331
  # Send email, SMS, push notification, etc.
302
332
  send_notification(notification)
@@ -334,7 +364,7 @@ class EventMessage < SmartMessage::Base
334
364
 
335
365
  config do
336
366
  transport SmartMessage::Transport.create(:stdout, output: 'events.log')
337
- serializer SmartMessage::Serializer::JSON.new
367
+ serializer SmartMessage::Serializer::Json.new
338
368
  end
339
369
  end
340
370
 
@@ -348,6 +378,5 @@ EventMessage.new(
348
378
 
349
379
  ## Need Help?
350
380
 
351
- - Check the [Troubleshooting Guide](troubleshooting.md)
352
- - Review the [API Reference](api-reference.md)
381
+ - Check the [Troubleshooting Guide](../development/troubleshooting.md)
353
382
  - Look at more [Examples](examples.md)