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.
- checksums.yaml +4 -4
- data/.github/workflows/deploy-github-pages.yml +38 -0
- data/.gitignore +5 -0
- data/CHANGELOG.md +30 -0
- data/Gemfile.lock +35 -4
- data/README.md +169 -71
- data/Rakefile +29 -4
- data/docs/assets/images/ddq_architecture.svg +130 -0
- data/docs/assets/images/dlq_architecture.svg +115 -0
- data/docs/assets/images/enhanced-dual-publishing.svg +136 -0
- data/docs/assets/images/enhanced-fluent-api.svg +149 -0
- data/docs/assets/images/enhanced-microservices-routing.svg +115 -0
- data/docs/assets/images/enhanced-pattern-matching.svg +107 -0
- data/docs/assets/images/fluent-api-demo.svg +59 -0
- data/docs/assets/images/performance-comparison.svg +161 -0
- data/docs/assets/images/redis-basic-architecture.svg +53 -0
- data/docs/assets/images/redis-enhanced-architecture.svg +88 -0
- data/docs/assets/images/redis-queue-architecture.svg +101 -0
- data/docs/assets/images/smart_message.jpg +0 -0
- data/docs/assets/images/smart_message_walking.jpg +0 -0
- data/docs/assets/images/smartmessage_architecture_overview.svg +173 -0
- data/docs/assets/images/transport-comparison-matrix.svg +171 -0
- data/docs/assets/javascripts/mathjax.js +17 -0
- data/docs/assets/stylesheets/extra.css +51 -0
- data/docs/{addressing.md → core-concepts/addressing.md} +5 -7
- data/docs/{architecture.md → core-concepts/architecture.md} +78 -138
- data/docs/{dispatcher.md → core-concepts/dispatcher.md} +21 -21
- data/docs/{message_filtering.md → core-concepts/message-filtering.md} +2 -3
- data/docs/{message_processing.md → core-concepts/message-processing.md} +17 -17
- data/docs/{troubleshooting.md → development/troubleshooting.md} +7 -7
- data/docs/{examples.md → getting-started/examples.md} +115 -89
- data/docs/{getting-started.md → getting-started/quick-start.md} +47 -18
- data/docs/guides/redis-queue-getting-started.md +697 -0
- data/docs/guides/redis-queue-patterns.md +889 -0
- data/docs/guides/redis-queue-production.md +1091 -0
- data/docs/index.md +64 -0
- data/docs/{dead_letter_queue.md → reference/dead-letter-queue.md} +2 -3
- data/docs/{logging.md → reference/logging.md} +1 -1
- data/docs/{message_deduplication.md → reference/message-deduplication.md} +1 -0
- data/docs/{proc_handlers_summary.md → reference/proc-handlers.md} +7 -6
- data/docs/{serializers.md → reference/serializers.md} +3 -5
- data/docs/{transports.md → reference/transports.md} +133 -11
- data/docs/transports/memory-transport.md +374 -0
- data/docs/transports/redis-enhanced-transport.md +524 -0
- data/docs/transports/redis-queue-transport.md +1304 -0
- data/docs/transports/redis-transport-comparison.md +496 -0
- data/docs/transports/redis-transport.md +509 -0
- data/examples/README.md +98 -5
- data/examples/city_scenario/911_emergency_call_flow.svg +99 -0
- data/examples/city_scenario/README.md +515 -0
- data/examples/city_scenario/ai_visitor_intelligence_flow.svg +108 -0
- data/examples/city_scenario/citizen.rb +195 -0
- data/examples/city_scenario/city_diagram.svg +125 -0
- data/examples/city_scenario/common/health_monitor.rb +80 -0
- data/examples/city_scenario/common/logger.rb +30 -0
- data/examples/city_scenario/emergency_dispatch_center.rb +270 -0
- data/examples/city_scenario/fire_department.rb +446 -0
- data/examples/city_scenario/fire_emergency_flow.svg +95 -0
- data/examples/city_scenario/health_department.rb +100 -0
- data/examples/city_scenario/health_monitoring_system.svg +130 -0
- data/examples/city_scenario/house.rb +244 -0
- data/examples/city_scenario/local_bank.rb +217 -0
- data/examples/city_scenario/messages/emergency_911_message.rb +81 -0
- data/examples/city_scenario/messages/emergency_resolved_message.rb +43 -0
- data/examples/city_scenario/messages/fire_dispatch_message.rb +43 -0
- data/examples/city_scenario/messages/fire_emergency_message.rb +45 -0
- data/examples/city_scenario/messages/health_check_message.rb +22 -0
- data/examples/city_scenario/messages/health_status_message.rb +35 -0
- data/examples/city_scenario/messages/police_dispatch_message.rb +46 -0
- data/examples/city_scenario/messages/silent_alarm_message.rb +38 -0
- data/examples/city_scenario/police_department.rb +316 -0
- data/examples/city_scenario/redis_monitor.rb +129 -0
- data/examples/city_scenario/redis_stats.rb +743 -0
- data/examples/city_scenario/room_for_improvement.md +240 -0
- data/examples/city_scenario/security_emergency_flow.svg +95 -0
- data/examples/city_scenario/service_internal_architecture.svg +154 -0
- data/examples/city_scenario/smart_message_ai_agent.rb +364 -0
- data/examples/city_scenario/start_demo.sh +236 -0
- data/examples/city_scenario/stop_demo.sh +106 -0
- data/examples/city_scenario/visitor.rb +631 -0
- data/examples/{10_message_deduplication.rb → memory/01_message_deduplication_demo.rb} +1 -1
- data/examples/{09_dead_letter_queue_demo.rb → memory/02_dead_letter_queue_demo.rb} +13 -40
- data/examples/{01_point_to_point_orders.rb → memory/03_point_to_point_orders.rb} +1 -1
- data/examples/{02_publish_subscribe_events.rb → memory/04_publish_subscribe_events.rb} +2 -2
- data/examples/{03_many_to_many_chat.rb → memory/05_many_to_many_chat.rb} +4 -4
- data/examples/{show_me.rb → memory/06_pretty_print_demo.rb} +1 -1
- data/examples/{05_proc_handlers.rb → memory/07_proc_handlers_demo.rb} +2 -2
- data/examples/{06_custom_logger_example.rb → memory/08_custom_logger_demo.rb} +17 -14
- data/examples/{07_error_handling_scenarios.rb → memory/09_error_handling_demo.rb} +4 -4
- data/examples/{08_entity_addressing_basic.rb → memory/10_entity_addressing_basic.rb} +8 -8
- data/examples/{08_entity_addressing_with_filtering.rb → memory/11_entity_addressing_with_filtering.rb} +6 -6
- data/examples/{09_regex_filtering_microservices.rb → memory/12_regex_filtering_microservices.rb} +2 -2
- data/examples/{10_header_block_configuration.rb → memory/13_header_block_configuration.rb} +6 -6
- data/examples/{11_global_configuration_example.rb → memory/14_global_configuration_demo.rb} +19 -8
- data/examples/{show_logger.rb → memory/15_logger_demo.rb} +1 -1
- data/examples/memory/README.md +163 -0
- data/examples/memory/memory_transport_architecture.svg +90 -0
- data/examples/memory/point_to_point_pattern.svg +94 -0
- data/examples/memory/publish_subscribe_pattern.svg +125 -0
- data/examples/{04_redis_smart_home_iot.rb → redis/01_smart_home_iot_demo.rb} +5 -5
- data/examples/redis/README.md +230 -0
- data/examples/redis/alert_system_flow.svg +127 -0
- data/examples/redis/dashboard_status_flow.svg +107 -0
- data/examples/redis/device_command_flow.svg +113 -0
- data/examples/redis/redis_transport_architecture.svg +115 -0
- data/examples/{smart_home_iot_dataflow.md → redis/smart_home_iot_dataflow.md} +4 -116
- data/examples/redis/smart_home_system_architecture.svg +133 -0
- data/examples/redis_enhanced/README.md +319 -0
- data/examples/redis_enhanced/enhanced_01_basic_patterns.rb +233 -0
- data/examples/redis_enhanced/enhanced_02_fluent_api.rb +331 -0
- data/examples/redis_enhanced/enhanced_03_dual_publishing.rb +281 -0
- data/examples/redis_enhanced/enhanced_04_advanced_routing.rb +419 -0
- data/examples/redis_queue/01_basic_messaging.rb +221 -0
- data/examples/redis_queue/01_comprehensive_examples.rb +508 -0
- data/examples/redis_queue/02_pattern_routing.rb +405 -0
- data/examples/redis_queue/03_fluent_api.rb +422 -0
- data/examples/redis_queue/04_load_balancing.rb +486 -0
- data/examples/redis_queue/05_microservices.rb +735 -0
- data/examples/redis_queue/06_emergency_alerts.rb +777 -0
- data/examples/redis_queue/07_queue_management.rb +587 -0
- data/examples/redis_queue/README.md +366 -0
- data/examples/redis_queue/enhanced_01_basic_patterns.rb +233 -0
- data/examples/redis_queue/enhanced_02_fluent_api.rb +331 -0
- data/examples/redis_queue/enhanced_03_dual_publishing.rb +281 -0
- data/examples/redis_queue/enhanced_04_advanced_routing.rb +419 -0
- data/examples/redis_queue/redis_queue_architecture.svg +148 -0
- data/ideas/README.md +41 -0
- data/ideas/agents.md +1001 -0
- data/ideas/database_transport.md +980 -0
- data/ideas/improvement.md +359 -0
- data/ideas/meshage.md +1788 -0
- data/ideas/message_discovery.md +178 -0
- data/ideas/message_schema.md +1381 -0
- data/lib/smart_message/.idea/.gitignore +8 -0
- data/lib/smart_message/.idea/markdown.xml +6 -0
- data/lib/smart_message/.idea/misc.xml +4 -0
- data/lib/smart_message/.idea/modules.xml +8 -0
- data/lib/smart_message/.idea/smart_message.iml +16 -0
- data/lib/smart_message/.idea/vcs.xml +6 -0
- data/lib/smart_message/addressing.rb +15 -0
- data/lib/smart_message/base.rb +0 -2
- data/lib/smart_message/configuration.rb +1 -1
- data/lib/smart_message/logger.rb +15 -4
- data/lib/smart_message/plugins.rb +5 -2
- data/lib/smart_message/serializer.rb +14 -0
- data/lib/smart_message/transport/redis_enhanced_transport.rb +399 -0
- data/lib/smart_message/transport/redis_queue_transport.rb +555 -0
- data/lib/smart_message/transport/registry.rb +1 -0
- data/lib/smart_message/transport.rb +34 -1
- data/lib/smart_message/version.rb +1 -1
- data/lib/smart_message.rb +5 -52
- data/mkdocs.yml +184 -0
- data/p2p_plan.md +326 -0
- data/p2p_roadmap.md +287 -0
- data/smart_message.gemspec +2 -0
- data/smart_message.svg +51 -0
- metadata +170 -44
- data/docs/README.md +0 -57
- data/examples/dead_letters.jsonl +0 -12
- data/examples/temp.txt +0 -94
- data/examples/tmux_chat/README.md +0 -283
- data/examples/tmux_chat/bot_agent.rb +0 -278
- data/examples/tmux_chat/human_agent.rb +0 -199
- data/examples/tmux_chat/room_monitor.rb +0 -160
- data/examples/tmux_chat/shared_chat_system.rb +0 -328
- data/examples/tmux_chat/start_chat_demo.sh +0 -190
- data/examples/tmux_chat/stop_chat_demo.sh +0 -22
- /data/docs/{properties.md → core-concepts/properties.md} +0 -0
- /data/docs/{ideas_to_think_about.md → development/ideas.md} +0 -0
data/docs/README.md
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
# SmartMessage Documentation
|
2
|
-
|
3
|
-
Welcome to the comprehensive documentation for SmartMessage, a Ruby gem that abstracts messages from backend transport systems.
|
4
|
-
|
5
|
-
## Table of Contents
|
6
|
-
|
7
|
-
### Getting Started
|
8
|
-
- [Installation & Quick Start](getting-started.md)
|
9
|
-
- [Basic Usage Examples](examples.md)
|
10
|
-
|
11
|
-
### Core Concepts
|
12
|
-
- [Architecture Overview](architecture.md)
|
13
|
-
- [Message Lifecycle](message-lifecycle.md)
|
14
|
-
- [Plugin System](plugin-system.md)
|
15
|
-
|
16
|
-
### Components
|
17
|
-
- [SmartMessage::Base](base.md)
|
18
|
-
- [Property System](properties.md)
|
19
|
-
- [Entity Addressing](addressing.md)
|
20
|
-
- [Message Filtering](message_filtering.md)
|
21
|
-
- [Transport Layer](transports.md)
|
22
|
-
- [Serializers](serializers.md)
|
23
|
-
- [Logging System](logging.md)
|
24
|
-
- [Dispatcher & Routing](dispatcher.md)
|
25
|
-
- [Message Headers](headers.md)
|
26
|
-
- [Dead Letter Queue](dead_letter_queue.md)
|
27
|
-
|
28
|
-
### Advanced Topics
|
29
|
-
- [Custom Transports](custom-transports.md)
|
30
|
-
- [Custom Serializers](custom-serializers.md)
|
31
|
-
- [Gateway Patterns](gateway-patterns.md)
|
32
|
-
- [Statistics & Monitoring](monitoring.md)
|
33
|
-
- [Thread Safety](thread-safety.md)
|
34
|
-
|
35
|
-
### Development
|
36
|
-
- [Testing Guide](testing.md)
|
37
|
-
- [Contributing](contributing.md)
|
38
|
-
- [Troubleshooting](troubleshooting.md)
|
39
|
-
|
40
|
-
### Reference
|
41
|
-
- [API Reference](api-reference.md)
|
42
|
-
- [Configuration Options](configuration.md)
|
43
|
-
- [Error Handling](error-handling.md)
|
44
|
-
|
45
|
-
## Quick Navigation
|
46
|
-
|
47
|
-
- **New to SmartMessage?** Start with [Getting Started](getting-started.md)
|
48
|
-
- **Need examples?** Check out [Examples](examples.md)
|
49
|
-
- **Understanding the architecture?** Read [Architecture Overview](architecture.md)
|
50
|
-
- **Building custom components?** See [Custom Transports](custom-transports.md) and [Custom Serializers](custom-serializers.md)
|
51
|
-
- **Having issues?** Visit [Troubleshooting](troubleshooting.md)
|
52
|
-
|
53
|
-
## Version
|
54
|
-
|
55
|
-
This documentation is for SmartMessage v0.0.8.
|
56
|
-
|
57
|
-
For older versions, please check the git tags and corresponding documentation.
|
data/examples/dead_letters.jsonl
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
{"timestamp":"2025-08-19T16:03:52-05:00","header":{"uuid":"ecb4c4f9-e9a7-47fd-918a-8dc5087218d6","message_class":"OrderMessage","published_at":"2025-08-19T16:03:52.374-05:00","publisher_pid":16266,"version":1,"from":"OrderService","serializer":"SmartMessage::Serializer::JSON"},"payload":"{\"order_id\":\"ORD-1001\",\"customer_id\":\"CUST-001\",\"amount\":99.99,\"currency\":\"USD\",\"payment_method\":\"credit_card\",\"items\":[\"Widget A\",\"Widget B\"]}","payload_format":"json","error":"wrong number of arguments (given 1, expected 2)","retry_count":0,"transport":"circuit_breaker","stack_trace":null}
|
2
|
-
{"timestamp":"2025-08-19T16:03:52-05:00","header":{"uuid":"40dce8a2-1723-48f5-ad01-fe49814991a2","message_class":"OrderMessage","published_at":"2025-08-19T16:03:52.889-05:00","publisher_pid":16266,"version":1,"from":"OrderService","serializer":"SmartMessage::Serializer::JSON"},"payload":"{\"order_id\":\"ORD-1002\",\"customer_id\":\"CUST-002\",\"amount\":1299.99,\"currency\":\"USD\",\"payment_method\":\"debit_card\",\"items\":[\"Premium Widget\",\"Extended Warranty\"]}","payload_format":"json","error":"wrong number of arguments (given 1, expected 2)","retry_count":0,"transport":"circuit_breaker","stack_trace":null}
|
3
|
-
{"timestamp":"2025-08-19T16:03:53-05:00","header":{"uuid":"0e1a228b-4069-4c05-b1ed-18193174d773","message_class":"OrderMessage","published_at":"2025-08-19T16:03:53.397-05:00","publisher_pid":16266,"version":1,"from":"OrderService","serializer":"SmartMessage::Serializer::JSON"},"payload":"{\"order_id\":\"ORD-1003\",\"customer_id\":\"CUST-003\",\"amount\":45.5,\"currency\":\"USD\",\"payment_method\":\"paypal\",\"items\":[\"Small Widget\"]}","payload_format":"json","error":"wrong number of arguments (given 1, expected 2)","retry_count":0,"transport":"circuit_breaker","stack_trace":null}
|
4
|
-
{"timestamp":"2025-08-19T16:04:01-05:00","header":{"uuid":"60ca2ca3-8185-4946-ae20-85269073ce3e","message_class":"UserEventMessage","published_at":"2025-08-19T16:04:01.582-05:00","publisher_pid":16396,"version":1,"from":"UserManager","serializer":"SmartMessage::Serializer::JSON"},"payload":"{\"event_id\":\"EVT-1001\",\"event_type\":\"user_registered\",\"user_id\":\"USER-101\",\"user_email\":\"alice@example.com\",\"user_name\":\"Alice Johnson\",\"timestamp\":\"2025-08-19T16:04:01-05:00\",\"metadata\":{\"source\":\"web_registration\"}}","payload_format":"json","error":"wrong number of arguments (given 1, expected 2)","retry_count":0,"transport":"circuit_breaker","stack_trace":null}
|
5
|
-
{"timestamp":"2025-08-19T16:23:07-05:00","header":{"uuid":"ebd1f61b-e5d9-48f4-a787-e1f9f4e09578","message_class":"SystemNotificationMessage","published_at":"2025-08-19T16:23:07.222-05:00","publisher_pid":24163,"version":1,"from":"user-001","serializer":"SmartMessage::Serializer::JSON"},"payload":"{\"notification_id\":\"NOTIF-1755638587-564\",\"room_id\":\"general\",\"notification_type\":\"user_joined\",\"content\":\"Alice joined the room\",\"timestamp\":\"2025-08-19T16:23:07-05:00\",\"metadata\":{\"triggered_by\":\"user-001\"}}","payload_format":"json","error":"undefined method 'handle_system_notification_user-001' for class 'HumanChatAgent'","retry_count":0,"transport":"circuit_breaker","stack_trace":null}
|
6
|
-
{"timestamp":"2025-08-19T16:25:50-05:00","header":{"uuid":"e722ef85-7168-42e2-94c2-cc55c1ca6784","message_class":"PaymentMessage","published_at":"2025-08-19T16:25:50.310-05:00","publisher_pid":25696,"version":1,"from":"payment-service","to":"dev-payment-processor","serializer":"SmartMessage::Serializer::JSON"},"payload":"{\"service_id\":\"payment-core\",\"message_type\":\"transaction_complete\",\"data\":{\"merchant\":\"Online Store\"},\"environment\":\"dev\",\"timestamp\":\"2025-08-19T16:25:50-05:00\",\"transaction_id\":\"TXN-001\",\"amount\":99.99,\"currency\":\"USD\"}","payload_format":"json","error":"undefined method 'process_dev' for class 'PaymentMessage'","retry_count":0,"transport":"circuit_breaker","stack_trace":null}
|
7
|
-
{"timestamp":"2025-08-19T16:25:50-05:00","header":{"uuid":"d36c3c66-bccc-49af-b919-b62bc6c9e1b2","message_class":"PaymentMessage","published_at":"2025-08-19T16:25:50.831-05:00","publisher_pid":25696,"version":1,"from":"payment-service","to":"prod-payment-processor","serializer":"SmartMessage::Serializer::JSON"},"payload":"{\"service_id\":\"payment-core\",\"message_type\":\"transaction_complete\",\"data\":{\"merchant\":\"Enterprise Store\"},\"environment\":\"prod\",\"timestamp\":\"2025-08-19T16:25:50-05:00\",\"transaction_id\":\"TXN-002\",\"amount\":299.99,\"currency\":\"USD\"}","payload_format":"json","error":"undefined method 'process_prod' for class 'PaymentMessage'","retry_count":0,"transport":"circuit_breaker","stack_trace":null}
|
8
|
-
{"timestamp":"2025-08-19T16:25:52-05:00","header":{"uuid":"d3371fb3-ed6e-403c-8f3b-3b130958a013","message_class":"AlertMessage","published_at":"2025-08-19T16:25:52.351-05:00","publisher_pid":25696,"version":1,"from":"admin","to":"security-dashboard","serializer":"SmartMessage::Serializer::JSON"},"payload":"{\"service_id\":\"security-scanner\",\"message_type\":\"security_alert\",\"data\":{\"attempts\":50,\"ip\":\"192.168.1.100\"},\"environment\":\"prod\",\"timestamp\":\"2025-08-19T16:25:52-05:00\",\"alert_level\":\"critical\",\"component\":\"authentication\",\"description\":\"Multiple failed login attempts detected\"}","payload_format":"json","error":"undefined method 'process_admin' for class 'AlertMessage'","retry_count":0,"transport":"circuit_breaker","stack_trace":null}
|
9
|
-
{"timestamp":"2025-08-19T16:25:52-05:00","header":{"uuid":"46a5b557-540c-4d50-a1f9-030907ba6275","message_class":"AlertMessage","published_at":"2025-08-19T16:25:52.860-05:00","publisher_pid":25696,"version":1,"from":"system-metrics","to":"ops-dashboard","serializer":"SmartMessage::Serializer::JSON"},"payload":"{\"service_id\":\"system-monitor\",\"message_type\":\"resource_alert\",\"data\":{\"usage_percent\":85,\"threshold\":80},\"environment\":\"staging\",\"timestamp\":\"2025-08-19T16:25:52-05:00\",\"alert_level\":\"warning\",\"component\":\"memory\",\"description\":\"Memory usage above threshold\"}","payload_format":"json","error":"Circuit 'message_processor' is open","retry_count":0,"transport":"circuit_breaker","stack_trace":null}
|
10
|
-
{"timestamp":"2025-08-19T16:25:52-05:00","header":{"uuid":"46a5b557-540c-4d50-a1f9-030907ba6275","message_class":"AlertMessage","published_at":"2025-08-19T16:25:52.860-05:00","publisher_pid":25696,"version":1,"from":"system-metrics","to":"ops-dashboard","serializer":"SmartMessage::Serializer::JSON"},"payload":"{\"service_id\":\"system-monitor\",\"message_type\":\"resource_alert\",\"data\":{\"usage_percent\":85,\"threshold\":80},\"environment\":\"staging\",\"timestamp\":\"2025-08-19T16:25:52-05:00\",\"alert_level\":\"warning\",\"component\":\"memory\",\"description\":\"Memory usage above threshold\"}","payload_format":"json","error":"Circuit 'message_processor' is open","retry_count":0,"transport":"circuit_breaker","stack_trace":null}
|
11
|
-
{"timestamp":"2025-08-19T16:25:53-05:00","header":{"uuid":"8ebceac3-8c5d-4253-b2a2-ce754084c3c2","message_class":"OrderMessage","published_at":"2025-08-19T16:25:53.365-05:00","publisher_pid":25696,"version":1,"from":"admin-dashboard","to":"prod-fulfillment","serializer":"SmartMessage::Serializer::JSON"},"payload":"{\"service_id\":\"admin-portal\",\"message_type\":\"admin_order_override\",\"data\":{\"priority\":\"high\",\"reason\":\"VIP customer\"},\"environment\":\"prod\",\"timestamp\":\"2025-08-19T16:25:53-05:00\",\"order_id\":\"ORD-999\",\"customer_id\":\"ADMIN\",\"status\":\"expedited\"}","payload_format":"json","error":"Circuit 'message_processor' is open","retry_count":0,"transport":"circuit_breaker","stack_trace":null}
|
12
|
-
{"timestamp":"2025-08-19T16:25:53-05:00","header":{"uuid":"8dfa4fed-f2df-4f66-81c2-963a97489a31","message_class":"PaymentMessage","published_at":"2025-08-19T16:25:53.873-05:00","publisher_pid":25696,"version":1,"from":"admin","serializer":"SmartMessage::Serializer::JSON"},"payload":"{\"service_id\":\"payment-system\",\"message_type\":\"system_maintenance\",\"data\":{\"message\":\"Scheduled maintenance in 30 minutes\",\"duration\":\"2 hours\",\"affected_services\":[\"payment\",\"billing\"]},\"environment\":\"prod\",\"timestamp\":\"2025-08-19T16:25:53-05:00\",\"transaction_id\":\"MAINT-001\",\"amount\":0,\"currency\":\"USD\"}","payload_format":"json","error":"Circuit 'message_processor' is open","retry_count":0,"transport":"circuit_breaker","stack_trace":null}
|
data/examples/temp.txt
DELETED
@@ -1,94 +0,0 @@
|
|
1
|
-
=== SmartMessage Example: Point-to-Point Order Processing ===
|
2
|
-
|
3
|
-
🚀 Starting Order Processing Demo
|
4
|
-
🏪 OrderService: Starting up...
|
5
|
-
💳 PaymentService: Starting up...
|
6
|
-
|
7
|
-
============================================================
|
8
|
-
Processing Sample Orders
|
9
|
-
============================================================
|
10
|
-
|
11
|
-
--- Order 1 ---
|
12
|
-
|
13
|
-
🏪 OrderService: Creating order ORD-1001
|
14
|
-
🏪 OrderService: Sending order to payment processing...
|
15
|
-
|
16
|
-
===================================================
|
17
|
-
== SmartMessage Published via STDOUT Transport
|
18
|
-
== Single-Tier Serialization:
|
19
|
-
== Message Class: OrderMessage
|
20
|
-
== Serialized Message: {"_sm_header":{"uuid":"d9a7f410-b902-4a67-9e22-694d3bf01b5f","message_class":"OrderMessage","published_at":"2025-08-20 12:02:21 -0500","publisher_pid":50033,"version":1,"from":"OrderService","serializer":"SmartMessage::Serializer::Json"},"_sm_payload":{"order_id":"ORD-1001","customer_id":"CUST-001","amount":99.99,"currency":"USD","payment_method":"credit_card","items":["Widget A","Widget B"]}}
|
21
|
-
===================================================
|
22
|
-
|
23
|
-
💳 PaymentService: Starting up...
|
24
|
-
💳 PaymentService: Processing payment for order ORD-1001
|
25
|
-
💳 PaymentService: Sending payment response...
|
26
|
-
|
27
|
-
===================================================
|
28
|
-
== SmartMessage Published via STDOUT Transport
|
29
|
-
== Single-Tier Serialization:
|
30
|
-
== Message Class: PaymentResponseMessage
|
31
|
-
== Serialized Message: {"_sm_header":{"uuid":"ca09a331-d5b9-4250-ab4c-542a1b1db9c7","message_class":"PaymentResponseMessage","published_at":"2025-08-20 12:02:21 -0500","publisher_pid":50033,"version":1,"from":"PaymentService","serializer":"SmartMessage::Serializer::Json"},"_sm_payload":{"order_id":"ORD-1001","payment_id":"PAY-5001","status":"success","message":"Payment processed successfully","processed_at":"2025-08-20T12:02:21-05:00"}}
|
32
|
-
===================================================
|
33
|
-
|
34
|
-
✅ Payment success: Order ORD-1001 - Payment processed successfully
|
35
|
-
|
36
|
-
--- Order 2 ---
|
37
|
-
|
38
|
-
🏪 OrderService: Creating order ORD-1002
|
39
|
-
🏪 OrderService: Sending order to payment processing...
|
40
|
-
|
41
|
-
===================================================
|
42
|
-
== SmartMessage Published via STDOUT Transport
|
43
|
-
== Single-Tier Serialization:
|
44
|
-
== Message Class: OrderMessage
|
45
|
-
== Serialized Message: {"_sm_header":{"uuid":"85ee7a93-ad19-48b3-9366-b6ed6dbb9e0e","message_class":"OrderMessage","published_at":"2025-08-20 12:02:22 -0500","publisher_pid":50033,"version":1,"from":"OrderService","serializer":"SmartMessage::Serializer::Json"},"_sm_payload":{"order_id":"ORD-1002","customer_id":"CUST-002","amount":1299.99,"currency":"USD","payment_method":"debit_card","items":["Premium Widget","Extended Warranty"]}}
|
46
|
-
===================================================
|
47
|
-
|
48
|
-
💳 PaymentService: Starting up...
|
49
|
-
💳 PaymentService: Processing payment for order ORD-1002
|
50
|
-
💳 PaymentService: Sending payment response...
|
51
|
-
|
52
|
-
===================================================
|
53
|
-
== SmartMessage Published via STDOUT Transport
|
54
|
-
== Single-Tier Serialization:
|
55
|
-
== Message Class: PaymentResponseMessage
|
56
|
-
== Serialized Message: {"_sm_header":{"uuid":"773c1dc9-5ee2-4866-a5d0-95701f436250","message_class":"PaymentResponseMessage","published_at":"2025-08-20 12:02:22 -0500","publisher_pid":50033,"version":1,"from":"PaymentService","serializer":"SmartMessage::Serializer::Json"},"_sm_payload":{"order_id":"ORD-1002","payment_id":"PAY-5001","status":"failed","message":"Insufficient funds","processed_at":"2025-08-20T12:02:22-05:00"}}
|
57
|
-
===================================================
|
58
|
-
|
59
|
-
❌ Payment failed: Order ORD-1002 - Insufficient funds
|
60
|
-
|
61
|
-
--- Order 3 ---
|
62
|
-
|
63
|
-
🏪 OrderService: Creating order ORD-1003
|
64
|
-
🏪 OrderService: Sending order to payment processing...
|
65
|
-
|
66
|
-
===================================================
|
67
|
-
== SmartMessage Published via STDOUT Transport
|
68
|
-
== Single-Tier Serialization:
|
69
|
-
== Message Class: OrderMessage
|
70
|
-
== Serialized Message: {"_sm_header":{"uuid":"5b3cb763-8c3e-470f-b6f9-dd5e0929f926","message_class":"OrderMessage","published_at":"2025-08-20 12:02:22 -0500","publisher_pid":50033,"version":1,"from":"OrderService","serializer":"SmartMessage::Serializer::Json"},"_sm_payload":{"order_id":"ORD-1003","customer_id":"CUST-003","amount":45.5,"currency":"USD","payment_method":"paypal","items":["Small Widget"]}}
|
71
|
-
===================================================
|
72
|
-
|
73
|
-
💳 PaymentService: Starting up...
|
74
|
-
💳 PaymentService: Processing payment for order ORD-1003
|
75
|
-
💳 PaymentService: Sending payment response...
|
76
|
-
|
77
|
-
===================================================
|
78
|
-
== SmartMessage Published via STDOUT Transport
|
79
|
-
== Single-Tier Serialization:
|
80
|
-
== Message Class: PaymentResponseMessage
|
81
|
-
== Serialized Message: {"_sm_header":{"uuid":"dc35ea12-28a5-4926-854a-d2cc52f6c91b","message_class":"PaymentResponseMessage","published_at":"2025-08-20 12:02:22 -0500","publisher_pid":50033,"version":1,"from":"PaymentService","serializer":"SmartMessage::Serializer::Json"},"_sm_payload":{"order_id":"ORD-1003","payment_id":"PAY-5001","status":"success","message":"Payment processed successfully","processed_at":"2025-08-20T12:02:22-05:00"}}
|
82
|
-
===================================================
|
83
|
-
|
84
|
-
✅ Payment success: Order ORD-1003 - Payment processed successfully
|
85
|
-
|
86
|
-
⏳ Waiting for all payments to process...
|
87
|
-
|
88
|
-
✨ Demo completed!
|
89
|
-
|
90
|
-
This example demonstrated:
|
91
|
-
• Point-to-point messaging between OrderService and PaymentService
|
92
|
-
• Bidirectional communication with request/response pattern
|
93
|
-
• JSON serialization of complex message data
|
94
|
-
• STDOUT transport with loopback for local demonstration
|
@@ -1,283 +0,0 @@
|
|
1
|
-
# SmartMessage Tmux Chat Visualization
|
2
|
-
|
3
|
-
This is an enhanced version of the many-to-many chat example that uses tmux to provide a clear, visual representation of the messaging interactions between different agents across multiple chat rooms.
|
4
|
-
|
5
|
-
## Overview
|
6
|
-
|
7
|
-
Instead of having all output mixed together in a single terminal, this tmux version separates:
|
8
|
-
|
9
|
-
- **Room Monitors**: Visual displays showing activity in each chat room
|
10
|
-
- **Human Agents**: Interactive chat clients for simulated users
|
11
|
-
- **Bot Agents**: Automated responders with various capabilities
|
12
|
-
|
13
|
-
## Layout
|
14
|
-
|
15
|
-
The tmux session creates three windows:
|
16
|
-
|
17
|
-
### Window 0: Chat Control Center (2x2 grid)
|
18
|
-
```
|
19
|
-
┌─────────────────┬─────────────────┐
|
20
|
-
│ General Room │ Tech Room │
|
21
|
-
│ Monitor │ Monitor │
|
22
|
-
├─────────────────┼─────────────────┤
|
23
|
-
│ Random Room │ System Info & │
|
24
|
-
│ Monitor │ Instructions │
|
25
|
-
└─────────────────┴─────────────────┘
|
26
|
-
```
|
27
|
-
|
28
|
-
### Window 1: Human Agents (3 panes)
|
29
|
-
```
|
30
|
-
┌─────────────────┬─────────────────┐
|
31
|
-
│ │ Bob │
|
32
|
-
│ Alice ├─────────────────┤
|
33
|
-
│ │ Carol │
|
34
|
-
└─────────────────┴─────────────────┘
|
35
|
-
```
|
36
|
-
|
37
|
-
### Window 2: Bot Agents (2 panes)
|
38
|
-
```
|
39
|
-
┌─────────────────┬─────────────────┐
|
40
|
-
│ HelpBot │ FunBot │
|
41
|
-
│ │ │
|
42
|
-
└─────────────────┴─────────────────┘
|
43
|
-
```
|
44
|
-
|
45
|
-
## Features
|
46
|
-
|
47
|
-
### Room Monitors
|
48
|
-
Each room monitor shows:
|
49
|
-
- Real-time message activity for that specific room
|
50
|
-
- User join/leave notifications
|
51
|
-
- Command detections
|
52
|
-
- Activity status (active/quiet/inactive)
|
53
|
-
- Message count and participant statistics
|
54
|
-
|
55
|
-
### Human Agents
|
56
|
-
Interactive chat clients with:
|
57
|
-
- Command support (`/join`, `/leave`, `/list`, `/help`, `/quit`)
|
58
|
-
- Multi-room messaging
|
59
|
-
- Auto-response to mentions
|
60
|
-
- Real-time message display
|
61
|
-
|
62
|
-
### Bot Agents
|
63
|
-
Automated agents with capabilities like:
|
64
|
-
- **HelpBot**: `/help`, `/stats`, `/time`
|
65
|
-
- **FunBot**: `/joke`, `/weather`, `/echo`
|
66
|
-
- Keyword responses (hello, help, thank you)
|
67
|
-
- Command processing with visual feedback
|
68
|
-
|
69
|
-
## Quick Start
|
70
|
-
|
71
|
-
### Prerequisites
|
72
|
-
- tmux installed (`brew install tmux` on macOS)
|
73
|
-
- Ruby with SmartMessage gem
|
74
|
-
- Terminal with decent size (recommended: 120x40 or larger)
|
75
|
-
|
76
|
-
### Running the Demo
|
77
|
-
|
78
|
-
```bash
|
79
|
-
# Start the entire chat system
|
80
|
-
cd examples/tmux_chat
|
81
|
-
./start_chat_demo.sh
|
82
|
-
```
|
83
|
-
|
84
|
-
### Navigation
|
85
|
-
|
86
|
-
Once in tmux:
|
87
|
-
|
88
|
-
**Switch Between Windows:**
|
89
|
-
- **Ctrl+b then 0**: Switch to Control Center (room monitors)
|
90
|
-
- **Ctrl+b then 1**: Switch to Human Agents (Alice, Bob, Carol)
|
91
|
-
- **Ctrl+b then 2**: Switch to Bot Agents (HelpBot, FunBot)
|
92
|
-
|
93
|
-
**Move Between Panes (within a window):**
|
94
|
-
- **Ctrl+b then o**: Cycle through all panes in current window
|
95
|
-
- **Ctrl+b then arrow keys**: Move directly to pane in that direction (↑↓←→)
|
96
|
-
- **Ctrl+b then ;**: Toggle between current and last pane
|
97
|
-
|
98
|
-
**Other Useful Commands:**
|
99
|
-
- **Ctrl+b then z**: Zoom current pane (toggle fullscreen)
|
100
|
-
- **Ctrl+b then d**: Detach from session (keeps it running)
|
101
|
-
- **Ctrl+b then ?**: Show all tmux commands
|
102
|
-
|
103
|
-
### Getting Started Workflow
|
104
|
-
|
105
|
-
1. **After starting the demo**, you'll be in the Human Agents window (window 1)
|
106
|
-
2. **Look for the active pane** (has colored border) - usually Alice's pane
|
107
|
-
3. **Start typing immediately** - you're in the chat interface, not bash
|
108
|
-
4. **Try these first commands:**
|
109
|
-
```
|
110
|
-
/join general
|
111
|
-
Hello everyone!
|
112
|
-
/help
|
113
|
-
```
|
114
|
-
5. **Switch to other agents** using `Ctrl+b then o` to see different perspectives
|
115
|
-
6. **Watch room activity** by switching to Control Center: `Ctrl+b then 0`
|
116
|
-
|
117
|
-
### Interacting with Agents
|
118
|
-
|
119
|
-
In any human agent pane (Alice, Bob, Carol):
|
120
|
-
```bash
|
121
|
-
# Join rooms
|
122
|
-
/join general
|
123
|
-
/join tech
|
124
|
-
/join random
|
125
|
-
|
126
|
-
# Send messages (goes to all your active rooms)
|
127
|
-
Hello everyone!
|
128
|
-
|
129
|
-
# Use bot commands
|
130
|
-
/help
|
131
|
-
/joke
|
132
|
-
/weather Tokyo
|
133
|
-
/stats
|
134
|
-
|
135
|
-
# Mention other users
|
136
|
-
@alice how are you?
|
137
|
-
|
138
|
-
# Leave rooms
|
139
|
-
/leave tech
|
140
|
-
|
141
|
-
# Exit
|
142
|
-
/quit
|
143
|
-
```
|
144
|
-
|
145
|
-
### Stopping the Demo
|
146
|
-
|
147
|
-
```bash
|
148
|
-
# From outside tmux
|
149
|
-
./stop_chat_demo.sh
|
150
|
-
|
151
|
-
# Or from inside tmux
|
152
|
-
Ctrl+b then d # Detach
|
153
|
-
./stop_chat_demo.sh
|
154
|
-
```
|
155
|
-
|
156
|
-
## Architecture
|
157
|
-
|
158
|
-
### File-Based Transport
|
159
|
-
|
160
|
-
This example uses a custom `FileTransport` that:
|
161
|
-
- Writes messages to room-specific queue files in `/tmp/smart_message_chat/`
|
162
|
-
- Polls files for new messages
|
163
|
-
- Enables inter-process communication between tmux panes
|
164
|
-
- Cleans up automatically on shutdown
|
165
|
-
|
166
|
-
### Message Types
|
167
|
-
|
168
|
-
Three types of messages flow through the system:
|
169
|
-
|
170
|
-
1. **ChatMessage**: Regular chat messages
|
171
|
-
2. **BotCommandMessage**: Commands directed to bots
|
172
|
-
3. **SystemNotificationMessage**: Join/leave/system events
|
173
|
-
|
174
|
-
### Agent Types
|
175
|
-
|
176
|
-
- **BaseAgent**: Common functionality for all agents
|
177
|
-
- **HumanChatAgent**: Interactive user simulation
|
178
|
-
- **BotChatAgent**: Automated response agents
|
179
|
-
- **RoomMonitor**: Display-only room activity monitors
|
180
|
-
|
181
|
-
## Advantages Over Single-Terminal Version
|
182
|
-
|
183
|
-
### Visual Clarity
|
184
|
-
- **Room Separation**: See each room's activity independently
|
185
|
-
- **Agent Separation**: Each agent has its own display space
|
186
|
-
- **Real-time Updates**: Monitors show live activity as it happens
|
187
|
-
|
188
|
-
### Better Understanding
|
189
|
-
- **Message Flow**: Clearly see how messages route between rooms
|
190
|
-
- **Agent Behavior**: Watch how different agents respond to events
|
191
|
-
- **System Dynamics**: Observe the many-to-many messaging patterns
|
192
|
-
|
193
|
-
### Interactive Experience
|
194
|
-
- **Multiple Perspectives**: Switch between different agent viewpoints
|
195
|
-
- **Live Interaction**: Type and send messages in real-time
|
196
|
-
- **System Monitoring**: Watch room activity while participating
|
197
|
-
|
198
|
-
## Example Workflow
|
199
|
-
|
200
|
-
1. **Start the demo**: `./start_chat_demo.sh`
|
201
|
-
2. **Watch the Control Center**: See rooms come online and initial messages
|
202
|
-
3. **Switch to Human Agents**: Navigate to Alice, Bob, or Carol
|
203
|
-
4. **Join rooms**: Use `/join general` to participate
|
204
|
-
5. **Send messages**: Type anything to chat in your active rooms
|
205
|
-
6. **Try bot commands**: Use `/joke`, `/weather`, `/help`
|
206
|
-
7. **Watch interactions**: Switch back to Control Center to see message flow
|
207
|
-
8. **Monitor bots**: Check Bot Agents window to see bot responses
|
208
|
-
|
209
|
-
## Customization
|
210
|
-
|
211
|
-
### Adding New Rooms
|
212
|
-
Edit `start_chat_demo.sh` to add more room monitors:
|
213
|
-
```bash
|
214
|
-
tmux new-window -t $SESSION_NAME -n "New-Room"
|
215
|
-
tmux send-keys "ruby room_monitor.rb newroom" C-m
|
216
|
-
```
|
217
|
-
|
218
|
-
### Adding New Agents
|
219
|
-
Create additional panes:
|
220
|
-
```bash
|
221
|
-
tmux split-window -t $SESSION_NAME:1 -v
|
222
|
-
tmux send-keys "ruby human_agent.rb david David" C-m
|
223
|
-
```
|
224
|
-
|
225
|
-
### Custom Bot Capabilities
|
226
|
-
Modify `bot_agent.rb` or create new bots:
|
227
|
-
```bash
|
228
|
-
ruby bot_agent.rb mybot MyBot "custom,commands,here"
|
229
|
-
```
|
230
|
-
|
231
|
-
## Troubleshooting
|
232
|
-
|
233
|
-
### Common Issues
|
234
|
-
|
235
|
-
**Tmux not found**:
|
236
|
-
```bash
|
237
|
-
# macOS
|
238
|
-
brew install tmux
|
239
|
-
|
240
|
-
# Ubuntu/Debian
|
241
|
-
sudo apt-get install tmux
|
242
|
-
```
|
243
|
-
|
244
|
-
**Messages not appearing**:
|
245
|
-
- Check that `/tmp/smart_message_chat/` directory exists
|
246
|
-
- Verify agents have joined the same rooms
|
247
|
-
- Try stopping and restarting the demo
|
248
|
-
|
249
|
-
**Pane too small**:
|
250
|
-
- Resize terminal window to at least 120x40
|
251
|
-
- Use `Ctrl+b then z` to zoom a pane temporarily
|
252
|
-
|
253
|
-
**Agents not responding**:
|
254
|
-
- Check that agents are in the same rooms (`/list` command)
|
255
|
-
- Verify bot capabilities match the commands being used
|
256
|
-
|
257
|
-
**Agents crash with console errors**:
|
258
|
-
- Fixed in latest version - agents now handle missing IO.console gracefully
|
259
|
-
- If issues persist, check Ruby version and terminal compatibility
|
260
|
-
|
261
|
-
### Manual Cleanup
|
262
|
-
|
263
|
-
If the automatic cleanup doesn't work:
|
264
|
-
```bash
|
265
|
-
# Kill tmux session
|
266
|
-
tmux kill-session -t smart_message_chat
|
267
|
-
|
268
|
-
# Remove message queues
|
269
|
-
rm -rf /tmp/smart_message_chat
|
270
|
-
```
|
271
|
-
|
272
|
-
## Educational Value
|
273
|
-
|
274
|
-
This visualization helps understand:
|
275
|
-
|
276
|
-
- **Many-to-many messaging patterns**
|
277
|
-
- **Room-based routing and filtering**
|
278
|
-
- **Agent coordination and communication**
|
279
|
-
- **Event-driven architecture**
|
280
|
-
- **Real-time system monitoring**
|
281
|
-
- **Service discovery and capabilities**
|
282
|
-
|
283
|
-
Perfect for demonstrating SmartMessage's power in complex, distributed scenarios!
|