smart_message 0.0.9 → 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 (176) 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 +53 -0
  5. data/Gemfile.lock +35 -4
  6. data/README.md +265 -69
  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} +129 -119
  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/reference/message-deduplication.md +489 -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/memory/01_message_deduplication_demo.rb +209 -0
  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 +2 -2
  142. data/lib/smart_message/configuration.rb +1 -1
  143. data/lib/smart_message/ddq/base.rb +71 -0
  144. data/lib/smart_message/ddq/memory.rb +109 -0
  145. data/lib/smart_message/ddq/redis.rb +168 -0
  146. data/lib/smart_message/ddq.rb +31 -0
  147. data/lib/smart_message/deduplication.rb +174 -0
  148. data/lib/smart_message/dispatcher.rb +175 -18
  149. data/lib/smart_message/logger.rb +15 -4
  150. data/lib/smart_message/plugins.rb +5 -2
  151. data/lib/smart_message/serializer.rb +14 -0
  152. data/lib/smart_message/subscription.rb +10 -7
  153. data/lib/smart_message/transport/redis_enhanced_transport.rb +399 -0
  154. data/lib/smart_message/transport/redis_queue_transport.rb +555 -0
  155. data/lib/smart_message/transport/registry.rb +1 -0
  156. data/lib/smart_message/transport.rb +34 -1
  157. data/lib/smart_message/version.rb +1 -1
  158. data/lib/smart_message.rb +5 -52
  159. data/mkdocs.yml +184 -0
  160. data/p2p_plan.md +326 -0
  161. data/p2p_roadmap.md +287 -0
  162. data/smart_message.gemspec +2 -0
  163. data/smart_message.svg +51 -0
  164. metadata +175 -42
  165. data/docs/README.md +0 -57
  166. data/examples/dead_letters.jsonl +0 -12
  167. data/examples/temp.txt +0 -94
  168. data/examples/tmux_chat/README.md +0 -283
  169. data/examples/tmux_chat/bot_agent.rb +0 -278
  170. data/examples/tmux_chat/human_agent.rb +0 -199
  171. data/examples/tmux_chat/room_monitor.rb +0 -160
  172. data/examples/tmux_chat/shared_chat_system.rb +0 -328
  173. data/examples/tmux_chat/start_chat_demo.sh +0 -190
  174. data/examples/tmux_chat/stop_chat_demo.sh +0 -22
  175. /data/docs/{properties.md → core-concepts/properties.md} +0 -0
  176. /data/docs/{ideas_to_think_about.md → development/ideas.md} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f02a7e60919734663addbef7ae2b5582bc142993654ef33fe17c90e1a70d138
4
- data.tar.gz: 50e7250d3e217faba23eb2a1d995b6edff0d9e0d7935bf2ea31602aff483a092
3
+ metadata.gz: 2e7bd096698c7b656fc3800dcbbd88366dccb0ae36be0a9a1f50240c944a6de3
4
+ data.tar.gz: 13235c27c12c4f76bdae091b0a432b505f0cfe49cd571fde387358aba98cf7da
5
5
  SHA512:
6
- metadata.gz: 7c157a60a127d4bd7a86742ccee8dff5385f11110d1449bc859742c497cc79d9a0e528dd39645d66a8e2b413602c31c4c79f73c9c560b5aacb37acc9610d3183
7
- data.tar.gz: 31fc0e365c549326e9a9314f435d50715c4c980e7380311e19a7428638198d2ce499f8acd104381a631b2a40cd66d2deb8bb7fa3e16c59a61a443cc980698b56
6
+ metadata.gz: 2b9b74f2203c1c6cd95a981e4f7c89d9fb6e1aad112c99b61420521ce95e89b4f3c378936ba9f435f67ee548b88e2e2ea28d70216856eaf898c028f1058f5d04
7
+ data.tar.gz: f7a9636706cb07e2b8df17e0e25b13128a2aed8a4ddd3d80ab28fadee3e27fc1ac52fafa9593f9854ffa54fb5920fe93334fb7f361c3394929c1fe4ea9be2adb
@@ -0,0 +1,38 @@
1
+ name: Deploy Documentation to GitHub Pages
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+ paths:
7
+ - "docs/**"
8
+ - "mkdocs.yml"
9
+ - ".github/workflows/deploy-github-pages.yml"
10
+ workflow_dispatch:
11
+
12
+ permissions:
13
+ contents: write
14
+ pages: write
15
+ id-token: write
16
+
17
+ jobs:
18
+ deploy:
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - name: Checkout code
22
+ uses: actions/checkout@v4
23
+ with:
24
+ fetch-depth: 0
25
+
26
+ - name: Setup Python
27
+ uses: actions/setup-python@v5
28
+ with:
29
+ python-version: 3.x
30
+
31
+ - name: Install dependencies
32
+ run: |
33
+ pip install mkdocs
34
+ pip install mkdocs-material
35
+ pip install mkdocs-macros-plugin
36
+
37
+ - name: Deploy to GitHub Pages
38
+ run: mkdocs gh-deploy --force
data/.gitignore CHANGED
@@ -8,3 +8,8 @@
8
8
  /pkg/
9
9
  /spec/reports/
10
10
  /tmp/
11
+ /.aigcm_msg/
12
+ site
13
+ .aigcm_msg
14
+ /log/
15
+ /logs/
data/CHANGELOG.md CHANGED
@@ -7,6 +7,59 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Added
11
+ - **Emergency Services Multi-Program Demo**: Complete emergency dispatch simulation system
12
+ - Added comprehensive emergency services message definitions with validation
13
+ - Emergency Dispatch Center (911) routing calls to appropriate departments
14
+ - Fire Department, Police Department, and Health Department service implementations
15
+ - AI-powered visitor generating realistic emergency scenarios with retry logic
16
+ - Health monitoring system across all city services with status reporting
17
+ - Continuous observation generation with diverse emergency scenarios every 15 seconds
18
+
19
+ ### Enhanced
20
+ - **Message Definition Property System**: Improved DRY principles and AI integration
21
+ - Extracted inline array validations into VALID_* constants (VALID_SEVERITY, VALID_EMERGENCY_TYPES, etc.)
22
+ - Updated property descriptions to use constants dynamically (#{VALID_SEVERITY.join(', ')})
23
+ - Enhanced property descriptions to include valid values for better AI prompting
24
+ - Standardized validation message format using constant interpolation across all message types
25
+ - **SmartMessage Class-Level Addressing**: Added setter method support for flexible syntax
26
+ - Added from=, to=, reply_to= setter methods to complement existing getter methods
27
+ - Enables both ClassName.from(value) and ClassName.from = value syntax patterns
28
+ - Maintains backward compatibility while improving developer experience
29
+
30
+ ### Added
31
+ - **Documentation Website**: MkDocs-based documentation site with GitHub Pages deployment
32
+ - Added `mkdocs.yml` configuration with Material theme and SmartMessage branding
33
+ - Created GitHub Actions workflow (`.github/workflows/deploy-github-pages.yml`) for automatic documentation deployment
34
+ - Reorganized documentation structure into logical sections: Getting Started, Core Concepts, Reference, and Development
35
+ - Added custom CSS styling for improved header visibility and readability
36
+ - Integrated SmartMessage logo and branding throughout the documentation
37
+ - Documentation now automatically deploys to GitHub Pages on push to master branch
38
+ - Live documentation available at: https://madbomber.github.io/smart_message/
39
+
40
+ ## [0.0.10] 2025-08-20
41
+ ### Added
42
+ - **Handler-Scoped Message Deduplication**: Advanced DDQ (Deduplication Queue) system with automatic handler isolation
43
+ - Handler-only DDQ scoping using `"MessageClass:HandlerMethod"` key format for natural isolation
44
+ - Automatic subscriber identification eliminates need for explicit `me:` parameter in API
45
+ - Cross-process deduplication support with independent DDQ instances per handler
46
+ - Memory and Redis storage backends with O(1) performance using hybrid Array + Set data structure
47
+ - Seamless integration with dispatcher - no changes required to existing subscription code
48
+ - Per-handler statistics and monitoring capabilities with DDQ utilization tracking
49
+ - Thread-safe circular buffer implementation with automatic eviction of oldest entries
50
+ - Configuration DSL: `ddq_size`, `ddq_storage`, `enable_deduplication!`, `disable_deduplication!`
51
+ - Comprehensive documentation and examples demonstrating distributed message processing scenarios
52
+
53
+ ### Fixed
54
+ - **Message Filtering Logic**: Fixed critical bug in subscription filtering where nil broadcast filters caused incorrect behavior
55
+ - **Root Cause**: `filters.key?(:broadcast)` returned true even when broadcast value was nil
56
+ - **Solution**: Changed condition to check for non-nil values: `filters[:to] || filters[:broadcast]`
57
+ - **Impact**: Subscription filtering now works correctly with nil filter values and maintains backward compatibility
58
+ - **Circuit Breaker Test Compatibility**: Added error handling for non-existent message classes in DDQ initialization
59
+ - Added rescue blocks around `constantize` calls to gracefully handle fake test classes
60
+ - DDQ initialization now skips gracefully for test classes that cannot be constantized
61
+ - Maintains proper DDQ functionality for real message classes while supporting test scenarios
62
+
10
63
  ## [0.0.9] 2025-08-20
11
64
  ### Added
12
65
  - **Advanced Logging Configuration System**: Comprehensive logger configuration with multiple output formats and options
data/Gemfile.lock CHANGED
@@ -1,8 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smart_message (0.0.9)
4
+ smart_message (0.0.12)
5
5
  activesupport
6
+ async
7
+ async-redis
6
8
  breaker_machines
7
9
  colorize
8
10
  concurrent-ruby
@@ -28,9 +30,23 @@ GEM
28
30
  tzinfo (~> 2.0, >= 2.0.5)
29
31
  uri (>= 0.13.1)
30
32
  amazing_print (1.8.1)
33
+ async (2.29.0)
34
+ console (~> 1.29)
35
+ fiber-annotation
36
+ io-event (~> 1.11)
37
+ metrics (~> 0.12)
38
+ traces (~> 0.18)
39
+ async-pool (0.11.0)
40
+ async (>= 2.0)
41
+ async-redis (0.12.0)
42
+ async (~> 2.10)
43
+ async-pool (~> 0.2)
44
+ io-endpoint (~> 0.10)
45
+ io-stream (~> 0.4)
46
+ protocol-redis (~> 0.11)
31
47
  base64 (0.3.0)
32
48
  benchmark (0.4.1)
33
- bigdecimal (3.2.2)
49
+ bigdecimal (3.2.3)
34
50
  breaker_machines (0.4.0)
35
51
  activesupport (>= 7.2)
36
52
  concurrent-ruby (~> 1.3)
@@ -38,20 +54,34 @@ GEM
38
54
  zeitwerk (~> 2.7)
39
55
  colorize (1.1.0)
40
56
  concurrent-ruby (1.3.5)
41
- connection_pool (2.5.3)
57
+ connection_pool (2.5.4)
58
+ console (1.34.0)
59
+ fiber-annotation
60
+ fiber-local (~> 1.1)
61
+ json
42
62
  debug_me (1.1.1)
43
63
  drb (2.2.3)
64
+ fiber-annotation (0.2.0)
65
+ fiber-local (1.1.0)
66
+ fiber-storage
67
+ fiber-storage (1.0.1)
44
68
  hashie (5.0.0)
45
69
  i18n (1.14.7)
46
70
  concurrent-ruby (~> 1.0)
71
+ io-endpoint (0.15.2)
72
+ io-event (1.13.0)
73
+ io-stream (0.10.0)
74
+ json (2.13.2)
47
75
  logger (1.7.0)
48
- lumberjack (1.4.0)
76
+ lumberjack (1.4.1)
77
+ metrics (0.14.0)
49
78
  minitest (5.25.5)
50
79
  minitest-power_assert (0.3.1)
51
80
  minitest
52
81
  power_assert (>= 1.1)
53
82
  mutex_m (0.3.0)
54
83
  power_assert (2.0.5)
84
+ protocol-redis (0.12.0)
55
85
  rake (13.3.0)
56
86
  redis (5.4.1)
57
87
  redis-client (>= 0.22.0)
@@ -65,6 +95,7 @@ GEM
65
95
  shoulda-matchers (4.5.1)
66
96
  activesupport (>= 4.2.0)
67
97
  state_machines (0.100.1)
98
+ traces (0.18.1)
68
99
  tzinfo (2.0.6)
69
100
  concurrent-ruby (~> 1.0)
70
101
  uri (1.0.3)