smart_message 0.0.8 → 0.0.10

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 (87) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.irbrc +24 -0
  4. data/CHANGELOG.md +119 -0
  5. data/Gemfile.lock +6 -1
  6. data/README.md +389 -17
  7. data/docs/README.md +3 -1
  8. data/docs/addressing.md +119 -13
  9. data/docs/architecture.md +184 -46
  10. data/docs/dead_letter_queue.md +673 -0
  11. data/docs/dispatcher.md +87 -0
  12. data/docs/examples.md +59 -1
  13. data/docs/getting-started.md +8 -1
  14. data/docs/logging.md +382 -326
  15. data/docs/message_deduplication.md +488 -0
  16. data/docs/message_filtering.md +451 -0
  17. data/examples/01_point_to_point_orders.rb +54 -53
  18. data/examples/02_publish_subscribe_events.rb +14 -10
  19. data/examples/03_many_to_many_chat.rb +16 -8
  20. data/examples/04_redis_smart_home_iot.rb +20 -10
  21. data/examples/05_proc_handlers.rb +12 -11
  22. data/examples/06_custom_logger_example.rb +95 -100
  23. data/examples/07_error_handling_scenarios.rb +4 -2
  24. data/examples/08_entity_addressing_basic.rb +18 -6
  25. data/examples/08_entity_addressing_with_filtering.rb +27 -9
  26. data/examples/09_dead_letter_queue_demo.rb +559 -0
  27. data/examples/09_regex_filtering_microservices.rb +407 -0
  28. data/examples/10_header_block_configuration.rb +263 -0
  29. data/examples/10_message_deduplication.rb +209 -0
  30. data/examples/11_global_configuration_example.rb +219 -0
  31. data/examples/README.md +102 -0
  32. data/examples/dead_letters.jsonl +12 -0
  33. data/examples/performance_metrics/benchmark_results_ractor_20250818_205603.json +135 -0
  34. data/examples/performance_metrics/benchmark_results_ractor_20250818_205831.json +135 -0
  35. data/examples/performance_metrics/benchmark_results_test_20250818_204942.json +130 -0
  36. data/examples/performance_metrics/benchmark_results_threadpool_20250818_204942.json +130 -0
  37. data/examples/performance_metrics/benchmark_results_threadpool_20250818_204959.json +130 -0
  38. data/examples/performance_metrics/benchmark_results_threadpool_20250818_205044.json +130 -0
  39. data/examples/performance_metrics/benchmark_results_threadpool_20250818_205109.json +130 -0
  40. data/examples/performance_metrics/benchmark_results_threadpool_20250818_205252.json +130 -0
  41. data/examples/performance_metrics/benchmark_results_unknown_20250819_172852.json +130 -0
  42. data/examples/performance_metrics/compare_benchmarks.rb +519 -0
  43. data/examples/performance_metrics/dead_letters.jsonl +3100 -0
  44. data/examples/performance_metrics/performance_benchmark.rb +344 -0
  45. data/examples/show_logger.rb +367 -0
  46. data/examples/show_me.rb +145 -0
  47. data/examples/temp.txt +94 -0
  48. data/examples/tmux_chat/bot_agent.rb +4 -2
  49. data/examples/tmux_chat/human_agent.rb +4 -2
  50. data/examples/tmux_chat/room_monitor.rb +4 -2
  51. data/examples/tmux_chat/shared_chat_system.rb +6 -3
  52. data/lib/smart_message/addressing.rb +259 -0
  53. data/lib/smart_message/base.rb +123 -599
  54. data/lib/smart_message/circuit_breaker.rb +2 -1
  55. data/lib/smart_message/configuration.rb +199 -0
  56. data/lib/smart_message/ddq/base.rb +71 -0
  57. data/lib/smart_message/ddq/memory.rb +109 -0
  58. data/lib/smart_message/ddq/redis.rb +168 -0
  59. data/lib/smart_message/ddq.rb +31 -0
  60. data/lib/smart_message/dead_letter_queue.rb +27 -10
  61. data/lib/smart_message/deduplication.rb +174 -0
  62. data/lib/smart_message/dispatcher.rb +259 -61
  63. data/lib/smart_message/header.rb +5 -0
  64. data/lib/smart_message/logger/base.rb +21 -1
  65. data/lib/smart_message/logger/default.rb +88 -138
  66. data/lib/smart_message/logger/lumberjack.rb +324 -0
  67. data/lib/smart_message/logger/null.rb +81 -0
  68. data/lib/smart_message/logger.rb +17 -9
  69. data/lib/smart_message/messaging.rb +100 -0
  70. data/lib/smart_message/plugins.rb +132 -0
  71. data/lib/smart_message/serializer/base.rb +25 -8
  72. data/lib/smart_message/serializer/json.rb +5 -4
  73. data/lib/smart_message/subscription.rb +196 -0
  74. data/lib/smart_message/transport/base.rb +72 -41
  75. data/lib/smart_message/transport/memory_transport.rb +7 -5
  76. data/lib/smart_message/transport/redis_transport.rb +15 -45
  77. data/lib/smart_message/transport/stdout_transport.rb +18 -8
  78. data/lib/smart_message/transport.rb +1 -34
  79. data/lib/smart_message/utilities.rb +142 -0
  80. data/lib/smart_message/version.rb +1 -1
  81. data/lib/smart_message/versioning.rb +85 -0
  82. data/lib/smart_message/wrapper.rb.bak +132 -0
  83. data/lib/smart_message.rb +74 -28
  84. data/smart_message.gemspec +3 -0
  85. metadata +83 -3
  86. data/lib/smart_message/serializer.rb +0 -10
  87. data/lib/smart_message/wrapper.rb +0 -43
@@ -0,0 +1,130 @@
1
+ {
2
+ "benchmark_info": {
3
+ "timestamp": "2025-08-18T20:50:44-05:00",
4
+ "implementation": "thread_pool",
5
+ "ruby_version": "3.4.5",
6
+ "platform": "arm64-darwin24",
7
+ "processor_count": 12
8
+ },
9
+ "overall_stats": {
10
+ "total_runtime": 1.828418,
11
+ "memory_used_mb": 83.328125
12
+ },
13
+ "scenario_results": {
14
+ "cpu_light": {
15
+ "name": "CPU Light",
16
+ "messages_generated": 1000,
17
+ "messages_published": 1000,
18
+ "messages_processed": 1000,
19
+ "errors": 0,
20
+ "times": {
21
+ "total": 0.382325,
22
+ "publish": 0.170594,
23
+ "processing": 0.10505
24
+ },
25
+ "throughput": {
26
+ "messages_per_second": 2615.575753612764,
27
+ "publish_rate": 5861.870874708372
28
+ },
29
+ "dispatcher_stats": {
30
+ "scheduled_task_count": 1000,
31
+ "completed_task_count": 1000,
32
+ "queue_length": 0,
33
+ "length": 1000,
34
+ "running": true
35
+ }
36
+ },
37
+ "cpu_heavy": {
38
+ "name": "CPU Heavy",
39
+ "messages_generated": 500,
40
+ "messages_published": 500,
41
+ "messages_processed": 500,
42
+ "errors": 0,
43
+ "times": {
44
+ "total": 0.59088,
45
+ "publish": 0.033234,
46
+ "processing": 0.469295
47
+ },
48
+ "throughput": {
49
+ "messages_per_second": 846.1955050094774,
50
+ "publish_rate": 15044.833604140338
51
+ },
52
+ "dispatcher_stats": {
53
+ "scheduled_task_count": 1500,
54
+ "completed_task_count": 1500,
55
+ "queue_length": 0,
56
+ "length": 1000,
57
+ "running": true
58
+ }
59
+ },
60
+ "io_light": {
61
+ "name": "I/O Light",
62
+ "messages_generated": 800,
63
+ "messages_published": 800,
64
+ "messages_processed": 800,
65
+ "errors": 0,
66
+ "times": {
67
+ "total": 0.284559,
68
+ "publish": 0.050618,
69
+ "processing": 0.102466
70
+ },
71
+ "throughput": {
72
+ "messages_per_second": 2811.367765560042,
73
+ "publish_rate": 15804.654470741632
74
+ },
75
+ "dispatcher_stats": {
76
+ "scheduled_task_count": 2300,
77
+ "completed_task_count": 2300,
78
+ "queue_length": 0,
79
+ "length": 1000,
80
+ "running": true
81
+ }
82
+ },
83
+ "io_heavy": {
84
+ "name": "I/O Heavy",
85
+ "messages_generated": 200,
86
+ "messages_published": 200,
87
+ "messages_processed": 200,
88
+ "errors": 0,
89
+ "times": {
90
+ "total": 0.14135,
91
+ "publish": 0.012542,
92
+ "processing": 0.101995
93
+ },
94
+ "throughput": {
95
+ "messages_per_second": 1414.9274849663955,
96
+ "publish_rate": 15946.420028703556
97
+ },
98
+ "dispatcher_stats": {
99
+ "scheduled_task_count": 2500,
100
+ "completed_task_count": 2500,
101
+ "queue_length": 0,
102
+ "length": 1000,
103
+ "running": true
104
+ }
105
+ },
106
+ "mixed": {
107
+ "name": "Mixed Load",
108
+ "messages_generated": 600,
109
+ "messages_published": 600,
110
+ "messages_processed": 600,
111
+ "errors": 0,
112
+ "times": {
113
+ "total": 0.411687,
114
+ "publish": 0.035677,
115
+ "processing": 0.287102
116
+ },
117
+ "throughput": {
118
+ "messages_per_second": 1457.417892719469,
119
+ "publish_rate": 16817.557530061385
120
+ },
121
+ "dispatcher_stats": {
122
+ "scheduled_task_count": 3100,
123
+ "completed_task_count": 3100,
124
+ "queue_length": 0,
125
+ "length": 1000,
126
+ "running": true
127
+ }
128
+ }
129
+ }
130
+ }
@@ -0,0 +1,130 @@
1
+ {
2
+ "benchmark_info": {
3
+ "timestamp": "2025-08-18T20:51:09-05:00",
4
+ "implementation": "thread_pool",
5
+ "ruby_version": "3.4.5",
6
+ "platform": "arm64-darwin24",
7
+ "processor_count": 12
8
+ },
9
+ "overall_stats": {
10
+ "total_runtime": 1.762657,
11
+ "memory_used_mb": 73.015625
12
+ },
13
+ "scenario_results": {
14
+ "cpu_light": {
15
+ "name": "CPU Light",
16
+ "messages_generated": 1000,
17
+ "messages_published": 1000,
18
+ "messages_processed": 1000,
19
+ "errors": 0,
20
+ "times": {
21
+ "total": 0.351877,
22
+ "publish": 0.141333,
23
+ "processing": 0.105033
24
+ },
25
+ "throughput": {
26
+ "messages_per_second": 2841.9021419416445,
27
+ "publish_rate": 7075.488385585816
28
+ },
29
+ "dispatcher_stats": {
30
+ "scheduled_task_count": 1000,
31
+ "completed_task_count": 1000,
32
+ "queue_length": 0,
33
+ "length": 816,
34
+ "running": true
35
+ }
36
+ },
37
+ "cpu_heavy": {
38
+ "name": "CPU Heavy",
39
+ "messages_generated": 500,
40
+ "messages_published": 500,
41
+ "messages_processed": 500,
42
+ "errors": 0,
43
+ "times": {
44
+ "total": 0.570031,
45
+ "publish": 0.045029,
46
+ "processing": 0.453406
47
+ },
48
+ "throughput": {
49
+ "messages_per_second": 877.1452780638247,
50
+ "publish_rate": 11103.955228852517
51
+ },
52
+ "dispatcher_stats": {
53
+ "scheduled_task_count": 1500,
54
+ "completed_task_count": 1500,
55
+ "queue_length": 0,
56
+ "length": 816,
57
+ "running": true
58
+ }
59
+ },
60
+ "io_light": {
61
+ "name": "I/O Light",
62
+ "messages_generated": 800,
63
+ "messages_published": 800,
64
+ "messages_processed": 800,
65
+ "errors": 0,
66
+ "times": {
67
+ "total": 0.258034,
68
+ "publish": 0.055317,
69
+ "processing": 0.105042
70
+ },
71
+ "throughput": {
72
+ "messages_per_second": 3100.36661835262,
73
+ "publish_rate": 14462.100258510043
74
+ },
75
+ "dispatcher_stats": {
76
+ "scheduled_task_count": 2300,
77
+ "completed_task_count": 2300,
78
+ "queue_length": 0,
79
+ "length": 816,
80
+ "running": true
81
+ }
82
+ },
83
+ "io_heavy": {
84
+ "name": "I/O Heavy",
85
+ "messages_generated": 200,
86
+ "messages_published": 200,
87
+ "messages_processed": 200,
88
+ "errors": 0,
89
+ "times": {
90
+ "total": 0.150409,
91
+ "publish": 0.014546,
92
+ "processing": 0.105047
93
+ },
94
+ "throughput": {
95
+ "messages_per_second": 1329.7076637701202,
96
+ "publish_rate": 13749.484394335212
97
+ },
98
+ "dispatcher_stats": {
99
+ "scheduled_task_count": 2500,
100
+ "completed_task_count": 2500,
101
+ "queue_length": 0,
102
+ "length": 816,
103
+ "running": true
104
+ }
105
+ },
106
+ "mixed": {
107
+ "name": "Mixed Load",
108
+ "messages_generated": 600,
109
+ "messages_published": 600,
110
+ "messages_processed": 600,
111
+ "errors": 0,
112
+ "times": {
113
+ "total": 0.416404,
114
+ "publish": 0.031952,
115
+ "processing": 0.286691
116
+ },
117
+ "throughput": {
118
+ "messages_per_second": 1440.908348622972,
119
+ "publish_rate": 18778.167250876315
120
+ },
121
+ "dispatcher_stats": {
122
+ "scheduled_task_count": 3100,
123
+ "completed_task_count": 3100,
124
+ "queue_length": 0,
125
+ "length": 816,
126
+ "running": true
127
+ }
128
+ }
129
+ }
130
+ }
@@ -0,0 +1,130 @@
1
+ {
2
+ "benchmark_info": {
3
+ "timestamp": "2025-08-18T20:52:52-05:00",
4
+ "implementation": "thread_pool",
5
+ "ruby_version": "3.4.5",
6
+ "platform": "arm64-darwin24",
7
+ "processor_count": 12
8
+ },
9
+ "overall_stats": {
10
+ "total_runtime": 1.71345,
11
+ "memory_used_mb": 67.484375
12
+ },
13
+ "scenario_results": {
14
+ "cpu_light": {
15
+ "name": "CPU Light",
16
+ "messages_generated": 1000,
17
+ "messages_published": 1000,
18
+ "messages_processed": 1000,
19
+ "errors": 0,
20
+ "times": {
21
+ "total": 0.358245,
22
+ "publish": 0.146183,
23
+ "processing": 0.105031
24
+ },
25
+ "throughput": {
26
+ "messages_per_second": 2791.385783472205,
27
+ "publish_rate": 6840.740715404664
28
+ },
29
+ "dispatcher_stats": {
30
+ "scheduled_task_count": 1000,
31
+ "completed_task_count": 1000,
32
+ "queue_length": 0,
33
+ "length": 767,
34
+ "running": true
35
+ }
36
+ },
37
+ "cpu_heavy": {
38
+ "name": "CPU Heavy",
39
+ "messages_generated": 500,
40
+ "messages_published": 500,
41
+ "messages_processed": 500,
42
+ "errors": 0,
43
+ "times": {
44
+ "total": 0.551001,
45
+ "publish": 0.037816,
46
+ "processing": 0.445864
47
+ },
48
+ "throughput": {
49
+ "messages_per_second": 907.439369438531,
50
+ "publish_rate": 13221.916649037443
51
+ },
52
+ "dispatcher_stats": {
53
+ "scheduled_task_count": 1500,
54
+ "completed_task_count": 1500,
55
+ "queue_length": 0,
56
+ "length": 767,
57
+ "running": true
58
+ }
59
+ },
60
+ "io_light": {
61
+ "name": "I/O Light",
62
+ "messages_generated": 800,
63
+ "messages_published": 800,
64
+ "messages_processed": 800,
65
+ "errors": 0,
66
+ "times": {
67
+ "total": 0.254371,
68
+ "publish": 0.055562,
69
+ "processing": 0.105019
70
+ },
71
+ "throughput": {
72
+ "messages_per_second": 3145.0125997067275,
73
+ "publish_rate": 14398.329793743926
74
+ },
75
+ "dispatcher_stats": {
76
+ "scheduled_task_count": 2300,
77
+ "completed_task_count": 2300,
78
+ "queue_length": 0,
79
+ "length": 800,
80
+ "running": true
81
+ }
82
+ },
83
+ "io_heavy": {
84
+ "name": "I/O Heavy",
85
+ "messages_generated": 200,
86
+ "messages_published": 200,
87
+ "messages_processed": 200,
88
+ "errors": 0,
89
+ "times": {
90
+ "total": 0.136309,
91
+ "publish": 0.009807,
92
+ "processing": 0.105042
93
+ },
94
+ "throughput": {
95
+ "messages_per_second": 1467.2545466550264,
96
+ "publish_rate": 20393.596410727034
97
+ },
98
+ "dispatcher_stats": {
99
+ "scheduled_task_count": 2500,
100
+ "completed_task_count": 2500,
101
+ "queue_length": 0,
102
+ "length": 800,
103
+ "running": true
104
+ }
105
+ },
106
+ "mixed": {
107
+ "name": "Mixed Load",
108
+ "messages_generated": 600,
109
+ "messages_published": 600,
110
+ "messages_processed": 600,
111
+ "errors": 0,
112
+ "times": {
113
+ "total": 0.396035,
114
+ "publish": 0.034099,
115
+ "processing": 0.27945
116
+ },
117
+ "throughput": {
118
+ "messages_per_second": 1515.0176120797403,
119
+ "publish_rate": 17595.823924455264
120
+ },
121
+ "dispatcher_stats": {
122
+ "scheduled_task_count": 3100,
123
+ "completed_task_count": 3100,
124
+ "queue_length": 0,
125
+ "length": 800,
126
+ "running": true
127
+ }
128
+ }
129
+ }
130
+ }
@@ -0,0 +1,130 @@
1
+ {
2
+ "benchmark_info": {
3
+ "timestamp": "2025-08-19T17:28:52-05:00",
4
+ "subject": "unknown",
5
+ "ruby_version": "3.4.5",
6
+ "platform": "arm64-darwin24",
7
+ "processors": 12
8
+ },
9
+ "overall_stats": {
10
+ "total_runtime": 2.160022,
11
+ "memory_used_mb": 86.9375
12
+ },
13
+ "scenario_results": {
14
+ "cpu_light": {
15
+ "name": "CPU Light",
16
+ "messages_generated": 1000,
17
+ "messages_published": 1000,
18
+ "messages_processed": 1000,
19
+ "errors": 0,
20
+ "times": {
21
+ "total": 0.635312,
22
+ "publish": 0.406514,
23
+ "processing": 0.105049
24
+ },
25
+ "throughput": {
26
+ "messages_per_second": 1574.0297680509734,
27
+ "publish_rate": 2459.939879069356
28
+ },
29
+ "dispatcher_stats": {
30
+ "scheduled_task_count": 1000,
31
+ "completed_task_count": 1000,
32
+ "queue_length": 0,
33
+ "length": 1000,
34
+ "running": true
35
+ }
36
+ },
37
+ "cpu_heavy": {
38
+ "name": "CPU Heavy",
39
+ "messages_generated": 500,
40
+ "messages_published": 500,
41
+ "messages_processed": 500,
42
+ "errors": 0,
43
+ "times": {
44
+ "total": 0.322838,
45
+ "publish": 0.150142,
46
+ "processing": 0.105063
47
+ },
48
+ "throughput": {
49
+ "messages_per_second": 1548.7643957650587,
50
+ "publish_rate": 3330.180762211773
51
+ },
52
+ "dispatcher_stats": {
53
+ "scheduled_task_count": 1500,
54
+ "completed_task_count": 1500,
55
+ "queue_length": 0,
56
+ "length": 1000,
57
+ "running": true
58
+ }
59
+ },
60
+ "io_light": {
61
+ "name": "I/O Light",
62
+ "messages_generated": 800,
63
+ "messages_published": 800,
64
+ "messages_processed": 800,
65
+ "errors": 0,
66
+ "times": {
67
+ "total": 0.50592,
68
+ "publish": 0.296219,
69
+ "processing": 0.10506
70
+ },
71
+ "throughput": {
72
+ "messages_per_second": 1581.2776723592663,
73
+ "publish_rate": 2700.7045462985157
74
+ },
75
+ "dispatcher_stats": {
76
+ "scheduled_task_count": 2300,
77
+ "completed_task_count": 2300,
78
+ "queue_length": 0,
79
+ "length": 1000,
80
+ "running": true
81
+ }
82
+ },
83
+ "io_heavy": {
84
+ "name": "I/O Heavy",
85
+ "messages_generated": 200,
86
+ "messages_published": 200,
87
+ "messages_processed": 200,
88
+ "errors": 0,
89
+ "times": {
90
+ "total": 0.204666,
91
+ "publish": 0.070861,
92
+ "processing": 0.105044
93
+ },
94
+ "throughput": {
95
+ "messages_per_second": 977.2018801364175,
96
+ "publish_rate": 2822.427004981584
97
+ },
98
+ "dispatcher_stats": {
99
+ "scheduled_task_count": 2500,
100
+ "completed_task_count": 2500,
101
+ "queue_length": 0,
102
+ "length": 1000,
103
+ "running": true
104
+ }
105
+ },
106
+ "mixed": {
107
+ "name": "Mixed Load",
108
+ "messages_generated": 600,
109
+ "messages_published": 600,
110
+ "messages_processed": 600,
111
+ "errors": 0,
112
+ "times": {
113
+ "total": 0.47226,
114
+ "publish": 0.263228,
115
+ "processing": 0.105055
116
+ },
117
+ "throughput": {
118
+ "messages_per_second": 1270.4865963664083,
119
+ "publish_rate": 2279.3927697661343
120
+ },
121
+ "dispatcher_stats": {
122
+ "scheduled_task_count": 3100,
123
+ "completed_task_count": 3100,
124
+ "queue_length": 0,
125
+ "length": 1000,
126
+ "running": true
127
+ }
128
+ }
129
+ }
130
+ }