smart_message 0.0.12 ā 0.0.13
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/CHANGELOG.md +35 -1
- data/Gemfile.lock +5 -5
- data/docs/core-concepts/architecture.md +5 -10
- data/docs/getting-started/examples.md +0 -12
- data/docs/getting-started/quick-start.md +4 -9
- data/docs/index.md +4 -4
- data/docs/reference/serializers.md +160 -488
- data/docs/reference/transports.md +1 -125
- data/docs/transports/redis-transport-comparison.md +215 -350
- data/docs/transports/redis-transport.md +3 -22
- data/examples/README.md +6 -9
- data/examples/city_scenario/README.md +1 -1
- data/examples/city_scenario/messages/emergency_911_message.rb +0 -1
- data/examples/city_scenario/messages/emergency_resolved_message.rb +0 -1
- data/examples/city_scenario/messages/fire_dispatch_message.rb +0 -1
- data/examples/city_scenario/messages/fire_emergency_message.rb +0 -1
- data/examples/city_scenario/messages/health_check_message.rb +0 -1
- data/examples/city_scenario/messages/health_status_message.rb +0 -1
- data/examples/city_scenario/messages/police_dispatch_message.rb +0 -1
- data/examples/city_scenario/messages/silent_alarm_message.rb +0 -1
- data/examples/memory/01_message_deduplication_demo.rb +0 -2
- data/examples/memory/02_dead_letter_queue_demo.rb +0 -3
- data/examples/memory/03_point_to_point_orders.rb +0 -2
- data/examples/memory/04_publish_subscribe_events.rb +0 -1
- data/examples/memory/05_many_to_many_chat.rb +0 -3
- data/examples/memory/07_proc_handlers_demo.rb +0 -1
- data/examples/memory/08_custom_logger_demo.rb +0 -4
- data/examples/memory/09_error_handling_demo.rb +0 -3
- data/examples/memory/10_entity_addressing_basic.rb +0 -6
- data/examples/memory/11_entity_addressing_with_filtering.rb +0 -4
- data/examples/memory/12_regex_filtering_microservices.rb +0 -1
- data/examples/memory/13_header_block_configuration.rb +0 -5
- data/examples/memory/14_global_configuration_demo.rb +0 -2
- data/examples/memory/15_logger_demo.rb +0 -1
- data/examples/memory/README.md +3 -3
- data/examples/redis/01_smart_home_iot_demo.rb +0 -4
- data/examples/redis/README.md +0 -2
- data/lib/smart_message/base.rb +19 -10
- data/lib/smart_message/configuration.rb +2 -23
- data/lib/smart_message/dead_letter_queue.rb +1 -1
- data/lib/smart_message/messaging.rb +3 -62
- data/lib/smart_message/plugins.rb +1 -42
- data/lib/smart_message/transport/base.rb +42 -8
- data/lib/smart_message/transport/memory_transport.rb +23 -4
- data/lib/smart_message/transport/redis_transport.rb +11 -0
- data/lib/smart_message/transport/registry.rb +0 -1
- data/lib/smart_message/transport/stdout_transport.rb +28 -10
- data/lib/smart_message/transport.rb +0 -1
- data/lib/smart_message/version.rb +1 -1
- metadata +2 -28
- data/docs/guides/redis-queue-getting-started.md +0 -697
- data/docs/guides/redis-queue-patterns.md +0 -889
- data/docs/guides/redis-queue-production.md +0 -1091
- data/docs/transports/redis-enhanced-transport.md +0 -524
- data/docs/transports/redis-queue-transport.md +0 -1304
- data/examples/redis_enhanced/README.md +0 -319
- data/examples/redis_enhanced/enhanced_01_basic_patterns.rb +0 -233
- data/examples/redis_enhanced/enhanced_02_fluent_api.rb +0 -331
- data/examples/redis_enhanced/enhanced_03_dual_publishing.rb +0 -281
- data/examples/redis_enhanced/enhanced_04_advanced_routing.rb +0 -419
- data/examples/redis_queue/01_basic_messaging.rb +0 -221
- data/examples/redis_queue/01_comprehensive_examples.rb +0 -508
- data/examples/redis_queue/02_pattern_routing.rb +0 -405
- data/examples/redis_queue/03_fluent_api.rb +0 -422
- data/examples/redis_queue/04_load_balancing.rb +0 -486
- data/examples/redis_queue/05_microservices.rb +0 -735
- data/examples/redis_queue/06_emergency_alerts.rb +0 -777
- data/examples/redis_queue/07_queue_management.rb +0 -587
- data/examples/redis_queue/README.md +0 -366
- data/examples/redis_queue/enhanced_01_basic_patterns.rb +0 -233
- data/examples/redis_queue/enhanced_02_fluent_api.rb +0 -331
- data/examples/redis_queue/enhanced_03_dual_publishing.rb +0 -281
- data/examples/redis_queue/enhanced_04_advanced_routing.rb +0 -419
- data/examples/redis_queue/redis_queue_architecture.svg +0 -148
- data/lib/smart_message/transport/redis_enhanced_transport.rb +0 -399
- data/lib/smart_message/transport/redis_queue_transport.rb +0 -555
@@ -1,422 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# examples/redis_queue/03_fluent_api.rb
|
3
|
-
# Demonstration of the Fluent API for Redis Queue Transport
|
4
|
-
|
5
|
-
require_relative '../../lib/smart_message'
|
6
|
-
require 'async'
|
7
|
-
|
8
|
-
puts "šØ Redis Queue Transport - Fluent API Demo"
|
9
|
-
puts "=" * 50
|
10
|
-
|
11
|
-
#==============================================================================
|
12
|
-
# Transport Setup
|
13
|
-
#==============================================================================
|
14
|
-
|
15
|
-
transport = SmartMessage::Transport::RedisQueueTransport.new(
|
16
|
-
url: 'redis://localhost:6379',
|
17
|
-
db: 3, # Use database 3 for fluent API examples
|
18
|
-
queue_prefix: 'fluent_demo',
|
19
|
-
exchange_name: 'smart_message',
|
20
|
-
consumer_timeout: 1, # 1 second timeout
|
21
|
-
test_mode: false # Enable consumer tasks
|
22
|
-
)
|
23
|
-
|
24
|
-
#==============================================================================
|
25
|
-
# Message Classes
|
26
|
-
#==============================================================================
|
27
|
-
|
28
|
-
class TaskMessage < SmartMessage::Base
|
29
|
-
transport :redis_queue, {
|
30
|
-
url: 'redis://localhost:6379',
|
31
|
-
db: 3,
|
32
|
-
queue_prefix: 'fluent_demo',
|
33
|
-
exchange_name: 'smart_message',
|
34
|
-
test_mode: false
|
35
|
-
}
|
36
|
-
|
37
|
-
property :task_id, required: true
|
38
|
-
property :task_type, required: true
|
39
|
-
property :assigned_to
|
40
|
-
property :priority, default: 'medium'
|
41
|
-
property :estimated_hours, default: 1
|
42
|
-
|
43
|
-
def process
|
44
|
-
priority_icon = case priority
|
45
|
-
when 'critical' then 'š„'
|
46
|
-
when 'high' then 'ā”'
|
47
|
-
when 'medium' then 'āļø'
|
48
|
-
when 'low' then 'š'
|
49
|
-
else 'š'
|
50
|
-
end
|
51
|
-
|
52
|
-
puts "#{priority_icon} Task #{task_id} [#{task_type}] ā #{assigned_to} (#{estimated_hours}h)"
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
class EventMessage < SmartMessage::Base
|
57
|
-
transport :redis_queue, {
|
58
|
-
url: 'redis://localhost:6379',
|
59
|
-
db: 3,
|
60
|
-
queue_prefix: 'fluent_demo',
|
61
|
-
exchange_name: 'smart_message',
|
62
|
-
test_mode: false
|
63
|
-
}
|
64
|
-
|
65
|
-
property :event_type, required: true
|
66
|
-
property :user_id
|
67
|
-
property :session_id
|
68
|
-
property :metadata, default: {}
|
69
|
-
property :timestamp, default: -> { Time.now }
|
70
|
-
|
71
|
-
def process
|
72
|
-
puts "š Event: #{event_type} | User: #{user_id} | Session: #{session_id}"
|
73
|
-
puts " Metadata: #{metadata.inspect}" if metadata.any?
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
class AlertMessage < SmartMessage::Base
|
78
|
-
transport :redis_queue, {
|
79
|
-
url: 'redis://localhost:6379',
|
80
|
-
db: 3,
|
81
|
-
queue_prefix: 'fluent_demo',
|
82
|
-
exchange_name: 'smart_message',
|
83
|
-
test_mode: false
|
84
|
-
}
|
85
|
-
|
86
|
-
property :alert_id, required: true
|
87
|
-
property :service, required: true
|
88
|
-
property :level, required: true
|
89
|
-
property :description, required: true
|
90
|
-
property :tags, default: []
|
91
|
-
|
92
|
-
def process
|
93
|
-
level_icon = case level
|
94
|
-
when 'critical' then 'šØ'
|
95
|
-
when 'warning' then 'ā ļø'
|
96
|
-
when 'info' then 'ā¹ļø'
|
97
|
-
else 'š¢'
|
98
|
-
end
|
99
|
-
|
100
|
-
puts "#{level_icon} Alert #{alert_id}: #{service} - #{description}"
|
101
|
-
puts " Tags: #{tags.join(', ')}" if tags.any?
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
#==============================================================================
|
106
|
-
# Fluent API Subscription Examples
|
107
|
-
#==============================================================================
|
108
|
-
|
109
|
-
Async do
|
110
|
-
puts "\nš Setting up Fluent API subscriptions:"
|
111
|
-
|
112
|
-
# Example 1: Simple FROM subscription
|
113
|
-
puts "1ļøā£ Subscribe to messages FROM 'api_service'"
|
114
|
-
subscription1 = transport.where
|
115
|
-
.from('api_service')
|
116
|
-
.subscribe do |message_class, message_data|
|
117
|
-
data = JSON.parse(message_data)
|
118
|
-
puts "šµ API Service Message: #{message_class} - #{data['task_id'] || data['event_type'] || data['alert_id']}"
|
119
|
-
end
|
120
|
-
|
121
|
-
# Example 2: Simple TO subscription
|
122
|
-
puts "2ļøā£ Subscribe to messages TO 'task_processor'"
|
123
|
-
subscription2 = transport.where
|
124
|
-
.to('task_processor')
|
125
|
-
.subscribe do |message_class, message_data|
|
126
|
-
data = JSON.parse(message_data)
|
127
|
-
puts "š¢ Task Processor: #{message_class} - #{data['task_id'] || data['task_type']}"
|
128
|
-
end
|
129
|
-
|
130
|
-
# Example 3: Type-specific subscription
|
131
|
-
puts "3ļøā£ Subscribe to TaskMessage types only"
|
132
|
-
subscription3 = transport.where
|
133
|
-
.type('TaskMessage')
|
134
|
-
.subscribe do |message_class, message_data|
|
135
|
-
data = JSON.parse(message_data)
|
136
|
-
puts "š Task Only: #{data['task_id']} - #{data['task_type']} [#{data['priority']}]"
|
137
|
-
end
|
138
|
-
|
139
|
-
# Example 4: Combined FROM and TO
|
140
|
-
puts "4ļøā£ Subscribe FROM 'web_app' TO 'event_processor'"
|
141
|
-
subscription4 = transport.where
|
142
|
-
.from('web_app')
|
143
|
-
.to('event_processor')
|
144
|
-
.subscribe do |message_class, message_data|
|
145
|
-
data = JSON.parse(message_data)
|
146
|
-
puts "šā”ļøš WebāEvents: #{message_class} - #{data['event_type']}"
|
147
|
-
end
|
148
|
-
|
149
|
-
# Example 5: Consumer group with load balancing
|
150
|
-
puts "5ļøā£ Subscribe with consumer group 'alert_handlers'"
|
151
|
-
subscription5 = transport.where
|
152
|
-
.type('AlertMessage')
|
153
|
-
.consumer_group('alert_handlers')
|
154
|
-
.subscribe do |message_class, message_data|
|
155
|
-
data = JSON.parse(message_data)
|
156
|
-
fiber_id = Async::Task.current.object_id.to_s[-4..-1]
|
157
|
-
puts "ā” Fiber-#{fiber_id}: Alert #{data['alert_id']} [#{data['level']}]"
|
158
|
-
end
|
159
|
-
|
160
|
-
# Example 6: Complex multi-criteria subscription
|
161
|
-
puts "6ļøā£ Subscribe FROM admin services TO monitoring with group"
|
162
|
-
subscription6 = transport.where
|
163
|
-
.from(/^admin_.*/) # Regex pattern for admin services
|
164
|
-
.to('monitoring_service')
|
165
|
-
.consumer_group('monitoring_workers')
|
166
|
-
.subscribe do |message_class, message_data|
|
167
|
-
data = JSON.parse(message_data)
|
168
|
-
puts "šš AdmināMonitor: #{message_class}"
|
169
|
-
end
|
170
|
-
|
171
|
-
# Example 7: Type and destination combination
|
172
|
-
puts "7ļøā£ Subscribe to EventMessage TO analytics services"
|
173
|
-
subscription7 = transport.where
|
174
|
-
.type('EventMessage')
|
175
|
-
.to(/.*analytics.*/) # Any service with 'analytics' in name
|
176
|
-
.subscribe do |message_class, message_data|
|
177
|
-
data = JSON.parse(message_data)
|
178
|
-
puts "ššÆ EventsāAnalytics: #{data['event_type']} - User #{data['user_id']}"
|
179
|
-
end
|
180
|
-
|
181
|
-
# Wait for subscriptions to initialize
|
182
|
-
sleep 1
|
183
|
-
|
184
|
-
#============================================================================
|
185
|
-
# Pattern Building Demonstration
|
186
|
-
#============================================================================
|
187
|
-
|
188
|
-
puts "\nšļø Pattern Building Examples:"
|
189
|
-
|
190
|
-
# Show how different fluent combinations create patterns
|
191
|
-
builders = [
|
192
|
-
transport.where.from('api_service'),
|
193
|
-
transport.where.to('task_processor'),
|
194
|
-
transport.where.type('TaskMessage'),
|
195
|
-
transport.where.from('web_app').to('event_processor'),
|
196
|
-
transport.where.type('AlertMessage').from('monitoring'),
|
197
|
-
transport.where.to('analytics_service').type('EventMessage')
|
198
|
-
]
|
199
|
-
|
200
|
-
builders.each_with_index do |builder, i|
|
201
|
-
pattern = builder.build
|
202
|
-
puts "#{i + 1}. Pattern: '#{pattern}'"
|
203
|
-
end
|
204
|
-
|
205
|
-
#============================================================================
|
206
|
-
# Message Publishing Examples
|
207
|
-
#============================================================================
|
208
|
-
|
209
|
-
puts "\nš¤ Publishing messages to demonstrate fluent subscriptions:"
|
210
|
-
|
211
|
-
# Messages FROM api_service (triggers subscription 1)
|
212
|
-
puts "\nšø Messages FROM api_service:"
|
213
|
-
TaskMessage.new(
|
214
|
-
task_id: 'TASK-001',
|
215
|
-
task_type: 'data_processing',
|
216
|
-
assigned_to: 'task_processor',
|
217
|
-
priority: 'high',
|
218
|
-
_sm_header: { from: 'api_service', to: 'task_processor' }
|
219
|
-
).publish
|
220
|
-
|
221
|
-
EventMessage.new(
|
222
|
-
event_type: 'api_call',
|
223
|
-
user_id: 'user123',
|
224
|
-
session_id: 'sess456',
|
225
|
-
metadata: { endpoint: '/api/tasks', method: 'POST' },
|
226
|
-
_sm_header: { from: 'api_service', to: 'analytics_service' }
|
227
|
-
).publish
|
228
|
-
|
229
|
-
# Messages TO task_processor (triggers subscription 2)
|
230
|
-
puts "\nšø Messages TO task_processor:"
|
231
|
-
TaskMessage.new(
|
232
|
-
task_id: 'TASK-002',
|
233
|
-
task_type: 'image_processing',
|
234
|
-
assigned_to: 'task_processor',
|
235
|
-
priority: 'medium',
|
236
|
-
estimated_hours: 3,
|
237
|
-
_sm_header: { from: 'upload_service', to: 'task_processor' }
|
238
|
-
).publish
|
239
|
-
|
240
|
-
TaskMessage.new(
|
241
|
-
task_id: 'TASK-003',
|
242
|
-
task_type: 'email_processing',
|
243
|
-
assigned_to: 'task_processor',
|
244
|
-
priority: 'low',
|
245
|
-
_sm_header: { from: 'mail_service', to: 'task_processor' }
|
246
|
-
).publish
|
247
|
-
|
248
|
-
# TaskMessage types (triggers subscription 3)
|
249
|
-
puts "\nšø Various TaskMessage types:"
|
250
|
-
TaskMessage.new(
|
251
|
-
task_id: 'TASK-004',
|
252
|
-
task_type: 'backup_database',
|
253
|
-
assigned_to: 'backup_service',
|
254
|
-
priority: 'critical',
|
255
|
-
estimated_hours: 2,
|
256
|
-
_sm_header: { from: 'scheduler', to: 'backup_service' }
|
257
|
-
).publish
|
258
|
-
|
259
|
-
# Web app to event processor (triggers subscription 4)
|
260
|
-
puts "\nšø Web app to event processor:"
|
261
|
-
EventMessage.new(
|
262
|
-
event_type: 'page_view',
|
263
|
-
user_id: 'user789',
|
264
|
-
session_id: 'sess123',
|
265
|
-
metadata: { page: '/dashboard', referrer: '/login' },
|
266
|
-
_sm_header: { from: 'web_app', to: 'event_processor' }
|
267
|
-
).publish
|
268
|
-
|
269
|
-
EventMessage.new(
|
270
|
-
event_type: 'button_click',
|
271
|
-
user_id: 'user789',
|
272
|
-
session_id: 'sess123',
|
273
|
-
metadata: { button_id: 'save_profile', page: '/settings' },
|
274
|
-
_sm_header: { from: 'web_app', to: 'event_processor' }
|
275
|
-
).publish
|
276
|
-
|
277
|
-
# Alert messages for consumer groups (triggers subscription 5)
|
278
|
-
puts "\nšø Alert messages for load balancing:"
|
279
|
-
3.times do |i|
|
280
|
-
AlertMessage.new(
|
281
|
-
alert_id: "ALERT-#{sprintf('%03d', i + 1)}",
|
282
|
-
service: ['database', 'cache', 'api'][i],
|
283
|
-
level: ['critical', 'warning', 'info'][i],
|
284
|
-
description: ["Database connection lost", "Cache hit rate below 80%", "API response time normal"][i],
|
285
|
-
tags: [['db', 'urgent'], ['cache', 'performance'], ['api', 'info']][i],
|
286
|
-
_sm_header: { from: 'monitoring_service', to: 'alert_handler' }
|
287
|
-
).publish
|
288
|
-
end
|
289
|
-
|
290
|
-
# Admin messages to monitoring (triggers subscription 6)
|
291
|
-
puts "\nšø Admin messages to monitoring:"
|
292
|
-
AlertMessage.new(
|
293
|
-
alert_id: 'ADMIN-001',
|
294
|
-
service: 'user_management',
|
295
|
-
level: 'info',
|
296
|
-
description: 'User privileges updated for admin user',
|
297
|
-
tags: ['admin', 'security'],
|
298
|
-
_sm_header: { from: 'admin_panel', to: 'monitoring_service' }
|
299
|
-
).publish
|
300
|
-
|
301
|
-
EventMessage.new(
|
302
|
-
event_type: 'admin_action',
|
303
|
-
user_id: 'admin123',
|
304
|
-
metadata: { action: 'user_created', target_user: 'newuser456' },
|
305
|
-
_sm_header: { from: 'admin_service', to: 'monitoring_service' }
|
306
|
-
).publish
|
307
|
-
|
308
|
-
# Event messages to analytics (triggers subscription 7)
|
309
|
-
puts "\nšø Event messages to analytics services:"
|
310
|
-
EventMessage.new(
|
311
|
-
event_type: 'purchase_completed',
|
312
|
-
user_id: 'customer123',
|
313
|
-
session_id: 'shop_session_789',
|
314
|
-
metadata: { order_id: 'ORD-789', amount: 149.99, items: 3 },
|
315
|
-
_sm_header: { from: 'checkout_service', to: 'user_analytics' }
|
316
|
-
).publish
|
317
|
-
|
318
|
-
EventMessage.new(
|
319
|
-
event_type: 'search_query',
|
320
|
-
user_id: 'customer456',
|
321
|
-
metadata: { query: 'wireless headphones', results: 24 },
|
322
|
-
_sm_header: { from: 'search_service', to: 'search_analytics' }
|
323
|
-
).publish
|
324
|
-
|
325
|
-
# Wait for message processing
|
326
|
-
puts "\nā³ Processing all messages..."
|
327
|
-
sleep 5
|
328
|
-
|
329
|
-
#============================================================================
|
330
|
-
# Chained Fluent API Examples
|
331
|
-
#============================================================================
|
332
|
-
|
333
|
-
puts "\nš Advanced Fluent API Chaining:"
|
334
|
-
|
335
|
-
# Example of building and modifying subscriptions
|
336
|
-
puts "\n8ļøā£ Dynamic subscription building:"
|
337
|
-
base_subscription = transport.where.type('TaskMessage')
|
338
|
-
|
339
|
-
# Add criteria dynamically
|
340
|
-
urgent_tasks = base_subscription.from('urgent_processor')
|
341
|
-
pattern1 = urgent_tasks.build
|
342
|
-
puts "Dynamic pattern 1: #{pattern1}"
|
343
|
-
|
344
|
-
# Build different variations
|
345
|
-
analytics_tasks = base_subscription.to(/.*analytics.*/)
|
346
|
-
pattern2 = analytics_tasks.build
|
347
|
-
puts "Dynamic pattern 2: #{pattern2}"
|
348
|
-
|
349
|
-
# Complex chaining
|
350
|
-
complex_subscription = transport.where
|
351
|
-
.type('EventMessage')
|
352
|
-
.from(/^(web|mobile)_app$/) # From web or mobile app
|
353
|
-
.to(/.*analytics.*/) # To any analytics service
|
354
|
-
.consumer_group('analytics_processors')
|
355
|
-
|
356
|
-
pattern3 = complex_subscription.build
|
357
|
-
puts "Complex pattern: #{pattern3}"
|
358
|
-
|
359
|
-
# Subscribe with the complex pattern
|
360
|
-
complex_subscription.subscribe do |message_class, message_data|
|
361
|
-
data = JSON.parse(message_data)
|
362
|
-
puts "šÆ Complex Match: #{data['event_type']} from mobile/web ā analytics"
|
363
|
-
end
|
364
|
-
|
365
|
-
# Test the complex subscription
|
366
|
-
EventMessage.new(
|
367
|
-
event_type: 'app_launch',
|
368
|
-
user_id: 'mobile_user123',
|
369
|
-
metadata: { platform: 'iOS', version: '2.1.0' },
|
370
|
-
_sm_header: { from: 'mobile_app', to: 'mobile_analytics' }
|
371
|
-
).publish
|
372
|
-
|
373
|
-
sleep 2
|
374
|
-
|
375
|
-
#============================================================================
|
376
|
-
# Subscription Management
|
377
|
-
#============================================================================
|
378
|
-
|
379
|
-
puts "\nš Fluent API Statistics:"
|
380
|
-
|
381
|
-
# Show routing table
|
382
|
-
routing_table = transport.routing_table
|
383
|
-
puts "\nRouting patterns created by fluent API:"
|
384
|
-
routing_table.each_with_index do |(pattern, queues), i|
|
385
|
-
puts "#{i + 1}. '#{pattern}' ā #{queues.size} queue(s)"
|
386
|
-
end
|
387
|
-
|
388
|
-
# Show queue statistics
|
389
|
-
stats = transport.queue_stats
|
390
|
-
puts "\nQueue statistics:"
|
391
|
-
total_messages = 0
|
392
|
-
stats.each do |queue_name, info|
|
393
|
-
total_messages += info[:length]
|
394
|
-
puts " #{queue_name}: #{info[:length]} messages"
|
395
|
-
end
|
396
|
-
|
397
|
-
puts "\nTotal messages in all queues: #{total_messages}"
|
398
|
-
|
399
|
-
# Cleanup
|
400
|
-
transport.disconnect
|
401
|
-
end
|
402
|
-
|
403
|
-
puts "\nšØ Fluent API demonstration completed!"
|
404
|
-
|
405
|
-
puts "\nš” Fluent API Features Demonstrated:"
|
406
|
-
puts " ā .from() - Source-based filtering"
|
407
|
-
puts " ā .to() - Destination-based filtering"
|
408
|
-
puts " ā .type() - Message type filtering"
|
409
|
-
puts " ā .consumer_group() - Load balancing"
|
410
|
-
puts " ā Method chaining for complex criteria"
|
411
|
-
puts " ā Regex patterns in from/to filters"
|
412
|
-
puts " ā Dynamic subscription building"
|
413
|
-
puts " ā Pattern generation and inspection"
|
414
|
-
|
415
|
-
puts "\nš Key Benefits:"
|
416
|
-
puts " ⢠Readable, expressive subscription syntax"
|
417
|
-
puts " ⢠Type-safe subscription building"
|
418
|
-
puts " ⢠Flexible criteria combination"
|
419
|
-
puts " ⢠Runtime pattern inspection"
|
420
|
-
puts " ⢠Easy consumer group management with Async fibers"
|
421
|
-
puts " ⢠Complex routing made simple"
|
422
|
-
puts " ⢠Fiber-based concurrency for massive scalability"
|