bunny_farm 0.1.2
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 +7 -0
- data/.envrc +1 -0
- data/.github/workflows/docs.yml +38 -0
- data/.gitignore +11 -0
- data/.travis.yml +3 -0
- data/CHANGELOG.md +61 -0
- data/COMMITS.md +196 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +330 -0
- data/Rakefile +9 -0
- data/bunny_farm.gemspec +30 -0
- data/config/bunny.yml.erb +29 -0
- data/config/bunny_test.yml.erb +29 -0
- data/config/hipchat.yml.erb +12 -0
- data/docs/api/configuration.md +9 -0
- data/docs/api/consumer.md +8 -0
- data/docs/api/message-class.md +419 -0
- data/docs/api/publisher.md +9 -0
- data/docs/architecture/integration.md +8 -0
- data/docs/architecture/message-flow.md +11 -0
- data/docs/architecture/overview.md +448 -0
- data/docs/architecture/scaling.md +8 -0
- data/docs/assets/actions_dsl_flow.svg +109 -0
- data/docs/assets/architecture_overview.svg +152 -0
- data/docs/assets/best_practices_patterns.svg +203 -0
- data/docs/assets/bunny_farm_logo.png +0 -0
- data/docs/assets/configuration_api_methods.svg +104 -0
- data/docs/assets/configuration_flow.svg +130 -0
- data/docs/assets/configuration_hierarchy.svg +70 -0
- data/docs/assets/data_processing_pipeline.svg +131 -0
- data/docs/assets/debugging_monitoring.svg +165 -0
- data/docs/assets/ecommerce_example_flow.svg +145 -0
- data/docs/assets/email_campaign_example.svg +127 -0
- data/docs/assets/environment_variables_map.svg +78 -0
- data/docs/assets/error_handling_flow.svg +114 -0
- data/docs/assets/favicon.ico +1 -0
- data/docs/assets/fields_dsl_structure.svg +89 -0
- data/docs/assets/instance_methods_lifecycle.svg +137 -0
- data/docs/assets/integration_patterns.svg +207 -0
- data/docs/assets/json_serialization_flow.svg +153 -0
- data/docs/assets/logo.svg +4 -0
- data/docs/assets/message_api_overview.svg +126 -0
- data/docs/assets/message_encapsulation.svg +113 -0
- data/docs/assets/message_lifecycle.svg +110 -0
- data/docs/assets/message_structure.svg +138 -0
- data/docs/assets/publisher_consumer_api.svg +120 -0
- data/docs/assets/scaling_deployment_patterns.svg +195 -0
- data/docs/assets/smart_routing_diagram.svg +131 -0
- data/docs/assets/system_architecture_overview.svg +155 -0
- data/docs/assets/task_scheduling_flow.svg +139 -0
- data/docs/assets/testing_strategies.svg +146 -0
- data/docs/assets/workflow_patterns.svg +183 -0
- data/docs/assets/yaml_config_structure.svg +72 -0
- data/docs/configuration/environment-variables.md +14 -0
- data/docs/configuration/overview.md +373 -0
- data/docs/configuration/programmatic-setup.md +10 -0
- data/docs/configuration/yaml-configuration.md +12 -0
- data/docs/core-features/configuration.md +528 -0
- data/docs/core-features/error-handling.md +82 -0
- data/docs/core-features/json-serialization.md +545 -0
- data/docs/core-features/message-design.md +406 -0
- data/docs/core-features/smart-routing.md +467 -0
- data/docs/core-features/task-scheduling.md +67 -0
- data/docs/core-features/workflow-support.md +112 -0
- data/docs/development/contributing.md +345 -0
- data/docs/development/roadmap.md +9 -0
- data/docs/development/testing.md +14 -0
- data/docs/examples/order-processing.md +10 -0
- data/docs/examples/overview.md +269 -0
- data/docs/examples/real-world.md +8 -0
- data/docs/examples/simple-producer-consumer.md +15 -0
- data/docs/examples/task-scheduler.md +9 -0
- data/docs/getting-started/basic-concepts.md +274 -0
- data/docs/getting-started/installation.md +122 -0
- data/docs/getting-started/quick-start.md +158 -0
- data/docs/index.md +106 -0
- data/docs/message-structure/actions-dsl.md +163 -0
- data/docs/message-structure/fields-dsl.md +146 -0
- data/docs/message-structure/instance-methods.md +115 -0
- data/docs/message-structure/overview.md +211 -0
- data/examples/README.md +212 -0
- data/examples/consumer.rb +41 -0
- data/examples/images/message_flow.svg +87 -0
- data/examples/images/order_workflow.svg +122 -0
- data/examples/images/producer_consumer.svg +96 -0
- data/examples/images/task_scheduler.svg +140 -0
- data/examples/order_processor.rb +238 -0
- data/examples/producer.rb +60 -0
- data/examples/simple_message.rb +43 -0
- data/examples/task_scheduler.rb +263 -0
- data/images/architecture_overview.svg +152 -0
- data/images/bunny_farm_logo.png +0 -0
- data/images/configuration_flow.svg +130 -0
- data/images/message_structure.svg +138 -0
- data/lib/bunny_farm/.irbrc +7 -0
- data/lib/bunny_farm/generic_consumer.rb +12 -0
- data/lib/bunny_farm/hash_ext.rb +37 -0
- data/lib/bunny_farm/init_bunny.rb +137 -0
- data/lib/bunny_farm/init_hipchat.rb +49 -0
- data/lib/bunny_farm/message.rb +218 -0
- data/lib/bunny_farm/message_elements.rb +25 -0
- data/lib/bunny_farm/version.rb +3 -0
- data/lib/bunny_farm.rb +9 -0
- data/mkdocs.yml +148 -0
- metadata +244 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
<svg width="1000" height="700" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect width="1000" height="700" fill="transparent"/>
|
|
3
|
+
|
|
4
|
+
<!-- Title -->
|
|
5
|
+
<text x="500" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#e0e0e0">
|
|
6
|
+
E-commerce Order Processing Example
|
|
7
|
+
</text>
|
|
8
|
+
|
|
9
|
+
<!-- Order Processing Flow -->
|
|
10
|
+
<g>
|
|
11
|
+
<text x="500" y="70" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#68d391">
|
|
12
|
+
Complete Order Processing Workflow
|
|
13
|
+
</text>
|
|
14
|
+
|
|
15
|
+
<!-- Step 1: Order Created -->
|
|
16
|
+
<rect x="50" y="100" width="160" height="80" rx="8" fill="#2d3748" stroke="#68d391" stroke-width="2"/>
|
|
17
|
+
<text x="130" y="125" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#68d391">1. Order Created</text>
|
|
18
|
+
<text x="60" y="145" font-family="monospace" font-size="10" fill="#e0e0e0">OrderMessage.new</text>
|
|
19
|
+
<text x="60" y="160" font-family="monospace" font-size="10" fill="#e0e0e0">order_id: 12345</text>
|
|
20
|
+
<text x="60" y="175" font-family="monospace" font-size="10" fill="#e0e0e0">customer_id: "cust_789"</text>
|
|
21
|
+
|
|
22
|
+
<!-- Step 2: Validate -->
|
|
23
|
+
<rect x="240" y="100" width="160" height="80" rx="8" fill="#2d3748" stroke="#4299e1" stroke-width="2"/>
|
|
24
|
+
<text x="320" y="125" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#4299e1">2. Validate Order</text>
|
|
25
|
+
<text x="250" y="145" font-family="monospace" font-size="10" fill="#e0e0e0">msg.publish('validate')</text>
|
|
26
|
+
<text x="250" y="160" font-family="monospace" font-size="10" fill="#e0e0e0">• Check inventory</text>
|
|
27
|
+
<text x="250" y="175" font-family="monospace" font-size="10" fill="#e0e0e0">• Verify customer</text>
|
|
28
|
+
|
|
29
|
+
<!-- Step 3: Payment -->
|
|
30
|
+
<rect x="430" y="100" width="160" height="80" rx="8" fill="#2d3748" stroke="#9f7aea" stroke-width="2"/>
|
|
31
|
+
<text x="510" y="125" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#9f7aea">3. Process Payment</text>
|
|
32
|
+
<text x="440" y="145" font-family="monospace" font-size="10" fill="#e0e0e0">msg.publish('charge')</text>
|
|
33
|
+
<text x="440" y="160" font-family="monospace" font-size="10" fill="#e0e0e0">• Charge card</text>
|
|
34
|
+
<text x="440" y="175" font-family="monospace" font-size="10" fill="#e0e0e0">• Update status</text>
|
|
35
|
+
|
|
36
|
+
<!-- Step 4: Fulfill -->
|
|
37
|
+
<rect x="620" y="100" width="160" height="80" rx="8" fill="#2d3748" stroke="#f6e05e" stroke-width="2"/>
|
|
38
|
+
<text x="700" y="125" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#f6e05e">4. Fulfill Order</text>
|
|
39
|
+
<text x="630" y="145" font-family="monospace" font-size="10" fill="#e0e0e0">msg.publish('fulfill')</text>
|
|
40
|
+
<text x="630" y="160" font-family="monospace" font-size="10" fill="#e0e0e0">• Pick items</text>
|
|
41
|
+
<text x="630" y="175" font-family="monospace" font-size="10" fill="#e0e0e0">• Pack and ship</text>
|
|
42
|
+
|
|
43
|
+
<!-- Step 5: Complete -->
|
|
44
|
+
<rect x="810" y="100" width="160" height="80" rx="8" fill="#2d3748" stroke="#e53e3e" stroke-width="2"/>
|
|
45
|
+
<text x="890" y="125" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#e53e3e">5. Complete</text>
|
|
46
|
+
<text x="820" y="145" font-family="monospace" font-size="10" fill="#e0e0e0">msg.publish('complete')</text>
|
|
47
|
+
<text x="820" y="160" font-family="monospace" font-size="10" fill="#e0e0e0">• Send receipt</text>
|
|
48
|
+
<text x="820" y="175" font-family="monospace" font-size="10" fill="#e0e0e0">• Update CRM</text>
|
|
49
|
+
</g>
|
|
50
|
+
|
|
51
|
+
<!-- Message Definition -->
|
|
52
|
+
<g>
|
|
53
|
+
<text x="500" y="230" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#e0e0e0">
|
|
54
|
+
OrderMessage Implementation
|
|
55
|
+
</text>
|
|
56
|
+
|
|
57
|
+
<rect x="50" y="250" width="900" height="160" rx="8" fill="#2d3748" stroke="#4299e1" stroke-width="2"/>
|
|
58
|
+
<text x="500" y="275" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#4299e1">Complete Message Class</text>
|
|
59
|
+
|
|
60
|
+
<text x="70" y="300" font-family="monospace" font-size="11" fill="#68d391">class OrderMessage < BunnyFarm::Message</text>
|
|
61
|
+
<text x="80" y="320" font-family="monospace" font-size="11" fill="#f6e05e">fields</text>
|
|
62
|
+
<text x="130" y="320" font-family="monospace" font-size="11" fill="#e0e0e0">:order_id, :customer_id, :items, :total_amount, :status</text>
|
|
63
|
+
<text x="80" y="340" font-family="monospace" font-size="11" fill="#f6e05e">actions</text>
|
|
64
|
+
<text x="140" y="340" font-family="monospace" font-size="11" fill="#e0e0e0">:validate, :charge, :fulfill, :complete, :cancel</text>
|
|
65
|
+
|
|
66
|
+
<text x="80" y="365" font-family="monospace" font-size="11" fill="#9f7aea">def validate</text>
|
|
67
|
+
<text x="90" y="380" font-family="monospace" font-size="11" fill="#e0e0e0">return false unless inventory_available?</text>
|
|
68
|
+
<text x="90" y="395" font-family="monospace" font-size="11" fill="#e0e0e0">publish('charge') if valid?</text>
|
|
69
|
+
<text x="80" y="410" font-family="monospace" font-size="11" fill="#9f7aea">end</text>
|
|
70
|
+
|
|
71
|
+
<text x="400" y="365" font-family="monospace" font-size="11" fill="#9f7aea">def charge</text>
|
|
72
|
+
<text x="410" y="380" font-family="monospace" font-size="11" fill="#e0e0e0">payment = PaymentService.charge(total_amount)</text>
|
|
73
|
+
<text x="410" y="395" font-family="monospace" font-size="11" fill="#e0e0e0">publish('fulfill') if payment.success?</text>
|
|
74
|
+
<text x="400" y="410" font-family="monospace" font-size="11" fill="#9f7aea">end</text>
|
|
75
|
+
|
|
76
|
+
<text x="70" y="430" font-family="monospace" font-size="11" fill="#68d391">end</text>
|
|
77
|
+
</g>
|
|
78
|
+
|
|
79
|
+
<!-- Routing Keys -->
|
|
80
|
+
<g>
|
|
81
|
+
<text x="500" y="470" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#e0e0e0">
|
|
82
|
+
Generated Routing Keys and Queue Bindings
|
|
83
|
+
</text>
|
|
84
|
+
|
|
85
|
+
<!-- Routing Keys -->
|
|
86
|
+
<rect x="50" y="490" width="300" height="120" rx="6" fill="#1a202c" stroke="#ff9800" stroke-width="1"/>
|
|
87
|
+
<text x="200" y="510" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" font-weight="bold" fill="#ff9800">Generated Routing Keys</text>
|
|
88
|
+
<text x="60" y="530" font-family="monospace" font-size="10" fill="#e0e0e0">OrderMessage.validate</text>
|
|
89
|
+
<text x="60" y="545" font-family="monospace" font-size="10" fill="#e0e0e0">OrderMessage.charge</text>
|
|
90
|
+
<text x="60" y="560" font-family="monospace" font-size="10" fill="#e0e0e0">OrderMessage.fulfill</text>
|
|
91
|
+
<text x="60" y="575" font-family="monospace" font-size="10" fill="#e0e0e0">OrderMessage.complete</text>
|
|
92
|
+
<text x="60" y="590" font-family="monospace" font-size="10" fill="#e0e0e0">OrderMessage.cancel</text>
|
|
93
|
+
|
|
94
|
+
<!-- Queue Bindings -->
|
|
95
|
+
<rect x="370" y="490" width="280" height="120" rx="6" fill="#1a202c" stroke="#68d391" stroke-width="1"/>
|
|
96
|
+
<text x="510" y="510" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" font-weight="bold" fill="#68d391">Queue Binding Patterns</text>
|
|
97
|
+
<text x="380" y="530" font-family="monospace" font-size="10" fill="#e0e0e0">OrderMessage.*</text>
|
|
98
|
+
<text x="520" y="530" font-family="Arial, sans-serif" font-size="10" fill="#9ca3af"># All order operations</text>
|
|
99
|
+
<text x="380" y="545" font-family="monospace" font-size="10" fill="#e0e0e0">*.validate</text>
|
|
100
|
+
<text x="520" y="545" font-family="Arial, sans-serif" font-size="10" fill="#9ca3af"># All validation tasks</text>
|
|
101
|
+
<text x="380" y="560" font-family="monospace" font-size="10" fill="#e0e0e0">*.charge</text>
|
|
102
|
+
<text x="520" y="560" font-family="Arial, sans-serif" font-size="10" fill="#9ca3af"># Payment processing</text>
|
|
103
|
+
<text x="380" y="575" font-family="monospace" font-size="10" fill="#e0e0e0">*.fulfill</text>
|
|
104
|
+
<text x="520" y="575" font-family="Arial, sans-serif" font-size="10" fill="#9ca3af"># Fulfillment center</text>
|
|
105
|
+
<text x="380" y="590" font-family="monospace" font-size="10" fill="#e0e0e0">urgent.*</text>
|
|
106
|
+
<text x="520" y="590" font-family="Arial, sans-serif" font-size="10" fill="#9ca3af"># High priority queue</text>
|
|
107
|
+
|
|
108
|
+
<!-- Consumer Examples -->
|
|
109
|
+
<rect x="670" y="490" width="280" height="120" rx="6" fill="#1a202c" stroke="#9f7aea" stroke-width="1"/>
|
|
110
|
+
<text x="810" y="510" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" font-weight="bold" fill="#9f7aea">Consumer Workers</text>
|
|
111
|
+
<text x="680" y="530" font-family="Arial, sans-serif" font-size="10" fill="#e0e0e0">Order Validation Worker</text>
|
|
112
|
+
<text x="680" y="545" font-family="Arial, sans-serif" font-size="10" fill="#e0e0e0">Payment Processing Worker</text>
|
|
113
|
+
<text x="680" y="560" font-family="Arial, sans-serif" font-size="10" fill="#e0e0e0">Fulfillment Worker</text>
|
|
114
|
+
<text x="680" y="575" font-family="Arial, sans-serif" font-size="10" fill="#e0e0e0">Notification Worker</text>
|
|
115
|
+
<text x="680" y="590" font-family="Arial, sans-serif" font-size="10" fill="#e0e0e0">Analytics Worker</text>
|
|
116
|
+
</g>
|
|
117
|
+
|
|
118
|
+
<!-- Error Handling -->
|
|
119
|
+
<g>
|
|
120
|
+
<text x="500" y="650" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#e0e0e0">
|
|
121
|
+
Error Handling and Recovery
|
|
122
|
+
</text>
|
|
123
|
+
|
|
124
|
+
<rect x="100" y="670" width="200" height="25" rx="4" fill="#1a202c" stroke="#e53e3e" stroke-width="1"/>
|
|
125
|
+
<text x="200" y="687" text-anchor="middle" font-family="monospace" font-size="10" fill="#e53e3e">Payment Failed - Retry - Cancel</text>
|
|
126
|
+
|
|
127
|
+
<rect x="320" y="670" width="200" height="25" rx="4" fill="#1a202c" stroke="#f6e05e" stroke-width="1"/>
|
|
128
|
+
<text x="420" y="687" text-anchor="middle" font-family="monospace" font-size="10" fill="#f6e05e">Inventory Low - Backorder Queue</text>
|
|
129
|
+
|
|
130
|
+
<rect x="540" y="670" width="200" height="25" rx="4" fill="#1a202c" stroke="#4299e1" stroke-width="1"/>
|
|
131
|
+
<text x="640" y="687" text-anchor="middle" font-family="monospace" font-size="10" fill="#4299e1">Ship Failed - Dead Letter - Manual</text>
|
|
132
|
+
</g>
|
|
133
|
+
|
|
134
|
+
<!-- Flow arrows -->
|
|
135
|
+
<defs>
|
|
136
|
+
<marker id="arrow-ecomm" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
|
|
137
|
+
<polygon points="0 0, 8 3, 0 6" fill="#ff9800"/>
|
|
138
|
+
</marker>
|
|
139
|
+
</defs>
|
|
140
|
+
|
|
141
|
+
<line x1="210" y1="140" x2="240" y2="140" stroke="#ff9800" stroke-width="2" marker-end="url(#arrow-ecomm)"/>
|
|
142
|
+
<line x1="400" y1="140" x2="430" y2="140" stroke="#ff9800" stroke-width="2" marker-end="url(#arrow-ecomm)"/>
|
|
143
|
+
<line x1="590" y1="140" x2="620" y2="140" stroke="#ff9800" stroke-width="2" marker-end="url(#arrow-ecomm)"/>
|
|
144
|
+
<line x1="780" y1="140" x2="810" y2="140" stroke="#ff9800" stroke-width="2" marker-end="url(#arrow-ecomm)"/>
|
|
145
|
+
</svg>
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<svg width="900" height="600" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect width="900" height="600" fill="transparent"/>
|
|
3
|
+
|
|
4
|
+
<!-- Title -->
|
|
5
|
+
<text x="450" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#e0e0e0">
|
|
6
|
+
Email Campaign Management Example
|
|
7
|
+
</text>
|
|
8
|
+
|
|
9
|
+
<!-- Campaign Flow -->
|
|
10
|
+
<g>
|
|
11
|
+
<text x="450" y="70" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#4299e1">
|
|
12
|
+
Automated Email Campaign Workflow
|
|
13
|
+
</text>
|
|
14
|
+
|
|
15
|
+
<!-- Step 1: Trigger -->
|
|
16
|
+
<rect x="50" y="100" width="150" height="80" rx="8" fill="#2d3748" stroke="#68d391" stroke-width="2"/>
|
|
17
|
+
<text x="125" y="125" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#68d391">1. Campaign Trigger</text>
|
|
18
|
+
<text x="60" y="145" font-family="monospace" font-size="10" fill="#e0e0e0">User signs up</text>
|
|
19
|
+
<text x="60" y="160" font-family="monospace" font-size="10" fill="#e0e0e0">Purchase made</text>
|
|
20
|
+
<text x="60" y="175" font-family="monospace" font-size="10" fill="#e0e0e0">Birthday detected</text>
|
|
21
|
+
|
|
22
|
+
<!-- Step 2: Schedule -->
|
|
23
|
+
<rect x="220" y="100" width="150" height="80" rx="8" fill="#2d3748" stroke="#4299e1" stroke-width="2"/>
|
|
24
|
+
<text x="295" y="125" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#4299e1">2. Schedule Emails</text>
|
|
25
|
+
<text x="230" y="145" font-family="monospace" font-size="10" fill="#e0e0e0">welcome_series()</text>
|
|
26
|
+
<text x="230" y="160" font-family="monospace" font-size="10" fill="#e0e0e0">delay: immediate</text>
|
|
27
|
+
<text x="230" y="175" font-family="monospace" font-size="10" fill="#e0e0e0">follow_up: +3 days</text>
|
|
28
|
+
|
|
29
|
+
<!-- Step 3: Personalize -->
|
|
30
|
+
<rect x="390" y="100" width="150" height="80" rx="8" fill="#2d3748" stroke="#9f7aea" stroke-width="2"/>
|
|
31
|
+
<text x="465" y="125" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#9f7aea">3. Personalize</text>
|
|
32
|
+
<text x="400" y="145" font-family="monospace" font-size="10" fill="#e0e0e0">Load user data</text>
|
|
33
|
+
<text x="400" y="160" font-family="monospace" font-size="10" fill="#e0e0e0">Generate content</text>
|
|
34
|
+
<text x="400" y="175" font-family="monospace" font-size="10" fill="#e0e0e0">A/B test variant</text>
|
|
35
|
+
|
|
36
|
+
<!-- Step 4: Send -->
|
|
37
|
+
<rect x="560" y="100" width="150" height="80" rx="8" fill="#2d3748" stroke="#f6e05e" stroke-width="2"/>
|
|
38
|
+
<text x="635" y="125" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#f6e05e">4. Send Email</text>
|
|
39
|
+
<text x="570" y="145" font-family="monospace" font-size="10" fill="#e0e0e0">Email service API</text>
|
|
40
|
+
<text x="570" y="160" font-family="monospace" font-size="10" fill="#e0e0e0">Track delivery</text>
|
|
41
|
+
<text x="570" y="175" font-family="monospace" font-size="10" fill="#e0e0e0">Handle bounces</text>
|
|
42
|
+
|
|
43
|
+
<!-- Step 5: Track -->
|
|
44
|
+
<rect x="730" y="100" width="150" height="80" rx="8" fill="#2d3748" stroke="#e53e3e" stroke-width="2"/>
|
|
45
|
+
<text x="805" y="125" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#e53e3e">5. Track Results</text>
|
|
46
|
+
<text x="740" y="145" font-family="monospace" font-size="10" fill="#e0e0e0">Open rates</text>
|
|
47
|
+
<text x="740" y="160" font-family="monospace" font-size="10" fill="#e0e0e0">Click tracking</text>
|
|
48
|
+
<text x="740" y="175" font-family="monospace" font-size="10" fill="#e0e0e0">Conversion data</text>
|
|
49
|
+
</g>
|
|
50
|
+
|
|
51
|
+
<!-- Message Implementation -->
|
|
52
|
+
<g>
|
|
53
|
+
<text x="450" y="230" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#e0e0e0">
|
|
54
|
+
EmailCampaignMessage Implementation
|
|
55
|
+
</text>
|
|
56
|
+
|
|
57
|
+
<rect x="50" y="250" width="800" height="140" rx="8" fill="#2d3748" stroke="#4299e1" stroke-width="2"/>
|
|
58
|
+
<text x="450" y="275" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#4299e1">Campaign Message Class</text>
|
|
59
|
+
|
|
60
|
+
<text x="70" y="300" font-family="monospace" font-size="11" fill="#68d391">class EmailCampaignMessage < BunnyFarm::Message</text>
|
|
61
|
+
<text x="80" y="320" font-family="monospace" font-size="11" fill="#f6e05e">fields</text>
|
|
62
|
+
<text x="130" y="320" font-family="monospace" font-size="11" fill="#e0e0e0">:user_id, :campaign_id, :template_id, :send_at, :personalization_data</text>
|
|
63
|
+
<text x="80" y="340" font-family="monospace" font-size="11" fill="#f6e05e">actions</text>
|
|
64
|
+
<text x="140" y="340" font-family="monospace" font-size="11" fill="#e0e0e0">:schedule, :personalize, :send, :track, :retry</text>
|
|
65
|
+
|
|
66
|
+
<text x="80" y="365" font-family="monospace" font-size="11" fill="#9f7aea">def schedule</text>
|
|
67
|
+
<text x="90" y="380" font-family="monospace" font-size="11" fill="#e0e0e0">publish_at(send_at, 'personalize')</text>
|
|
68
|
+
<text x="80" y="395" font-family="monospace" font-size="11" fill="#9f7aea">end</text>
|
|
69
|
+
|
|
70
|
+
<text x="350" y="365" font-family="monospace" font-size="11" fill="#9f7aea">def send</text>
|
|
71
|
+
<text x="360" y="380" font-family="monospace" font-size="11" fill="#e0e0e0">EmailService.send(personalized_content)</text>
|
|
72
|
+
<text x="350" y="395" font-family="monospace" font-size="11" fill="#9f7aea">end</text>
|
|
73
|
+
|
|
74
|
+
<text x="70" y="415" font-family="monospace" font-size="11" fill="#68d391">end</text>
|
|
75
|
+
</g>
|
|
76
|
+
|
|
77
|
+
<!-- Campaign Types -->
|
|
78
|
+
<g>
|
|
79
|
+
<text x="450" y="450" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#e0e0e0">
|
|
80
|
+
Campaign Type Examples
|
|
81
|
+
</text>
|
|
82
|
+
|
|
83
|
+
<!-- Welcome Series -->
|
|
84
|
+
<rect x="50" y="470" width="200" height="100" rx="6" fill="#1a202c" stroke="#68d391" stroke-width="1"/>
|
|
85
|
+
<text x="150" y="490" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#68d391">Welcome Series</text>
|
|
86
|
+
<text x="60" y="510" font-family="monospace" font-size="10" fill="#e0e0e0">Day 0: Welcome email</text>
|
|
87
|
+
<text x="60" y="525" font-family="monospace" font-size="10" fill="#e0e0e0">Day 3: Getting started tips</text>
|
|
88
|
+
<text x="60" y="540" font-family="monospace" font-size="10" fill="#e0e0e0">Day 7: Feature highlights</text>
|
|
89
|
+
<text x="60" y="555" font-family="monospace" font-size="10" fill="#e0e0e0">Day 14: Success stories</text>
|
|
90
|
+
|
|
91
|
+
<!-- Abandoned Cart -->
|
|
92
|
+
<rect x="270" y="470" width="200" height="100" rx="6" fill="#1a202c" stroke="#f6e05e" stroke-width="1"/>
|
|
93
|
+
<text x="370" y="490" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#f6e05e">Abandoned Cart</text>
|
|
94
|
+
<text x="280" y="510" font-family="monospace" font-size="10" fill="#e0e0e0">1 hour: Gentle reminder</text>
|
|
95
|
+
<text x="280" y="525" font-family="monospace" font-size="10" fill="#e0e0e0">1 day: Special discount</text>
|
|
96
|
+
<text x="280" y="540" font-family="monospace" font-size="10" fill="#e0e0e0">3 days: Last chance</text>
|
|
97
|
+
<text x="280" y="555" font-family="monospace" font-size="10" fill="#e0e0e0">7 days: Product suggestions</text>
|
|
98
|
+
|
|
99
|
+
<!-- Re-engagement -->
|
|
100
|
+
<rect x="490" y="470" width="200" height="100" rx="6" fill="#1a202c" stroke="#9f7aea" stroke-width="1"/>
|
|
101
|
+
<text x="590" y="490" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#9f7aea">Re-engagement</text>
|
|
102
|
+
<text x="500" y="510" font-family="monospace" font-size="10" fill="#e0e0e0">30 days inactive: Check-in</text>
|
|
103
|
+
<text x="500" y="525" font-family="monospace" font-size="10" fill="#e0e0e0">60 days: What's new</text>
|
|
104
|
+
<text x="500" y="540" font-family="monospace" font-size="10" fill="#e0e0e0">90 days: Win-back offer</text>
|
|
105
|
+
<text x="500" y="555" font-family="monospace" font-size="10" fill="#e0e0e0">180 days: Goodbye email</text>
|
|
106
|
+
|
|
107
|
+
<!-- Birthday -->
|
|
108
|
+
<rect x="710" y="470" width="180" height="100" rx="6" fill="#1a202c" stroke="#e53e3e" stroke-width="1"/>
|
|
109
|
+
<text x="800" y="490" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#e53e3e">Birthday/Anniversary</text>
|
|
110
|
+
<text x="720" y="510" font-family="monospace" font-size="10" fill="#e0e0e0">Birthday: Special gift</text>
|
|
111
|
+
<text x="720" y="525" font-family="monospace" font-size="10" fill="#e0e0e0">Account anniversary</text>
|
|
112
|
+
<text x="720" y="540" font-family="monospace" font-size="10" fill="#e0e0e0">Purchase anniversary</text>
|
|
113
|
+
<text x="720" y="555" font-family="monospace" font-size="10" fill="#e0e0e0">Milestone celebrations</text>
|
|
114
|
+
</g>
|
|
115
|
+
|
|
116
|
+
<!-- Flow arrows -->
|
|
117
|
+
<defs>
|
|
118
|
+
<marker id="arrow-email" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
|
|
119
|
+
<polygon points="0 0, 8 3, 0 6" fill="#ff9800"/>
|
|
120
|
+
</marker>
|
|
121
|
+
</defs>
|
|
122
|
+
|
|
123
|
+
<line x1="200" y1="140" x2="220" y2="140" stroke="#ff9800" stroke-width="2" marker-end="url(#arrow-email)"/>
|
|
124
|
+
<line x1="370" y1="140" x2="390" y2="140" stroke="#ff9800" stroke-width="2" marker-end="url(#arrow-email)"/>
|
|
125
|
+
<line x1="540" y1="140" x2="560" y2="140" stroke="#ff9800" stroke-width="2" marker-end="url(#arrow-email)"/>
|
|
126
|
+
<line x1="710" y1="140" x2="730" y2="140" stroke="#ff9800" stroke-width="2" marker-end="url(#arrow-email)"/>
|
|
127
|
+
</svg>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<svg width="900" height="500" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect width="900" height="500" fill="transparent"/>
|
|
3
|
+
|
|
4
|
+
<!-- Title -->
|
|
5
|
+
<text x="450" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#e0e0e0">
|
|
6
|
+
Environment Variables Configuration Map
|
|
7
|
+
</text>
|
|
8
|
+
|
|
9
|
+
<!-- Connection Variables -->
|
|
10
|
+
<g>
|
|
11
|
+
<text x="450" y="70" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#4299e1">
|
|
12
|
+
RabbitMQ Connection Variables
|
|
13
|
+
</text>
|
|
14
|
+
|
|
15
|
+
<rect x="50" y="90" width="800" height="120" rx="8" fill="#2d3748" stroke="#4299e1" stroke-width="2"/>
|
|
16
|
+
<text x="450" y="115" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#4299e1">Primary Connection Settings</text>
|
|
17
|
+
|
|
18
|
+
<!-- Connection vars in two columns -->
|
|
19
|
+
<text x="70" y="140" font-family="monospace" font-size="11" fill="#68d391">RABBITMQ_URL</text>
|
|
20
|
+
<text x="250" y="140" font-family="Arial, sans-serif" font-size="11" fill="#e0e0e0">= "amqp://user:pass@host:port/vhost"</text>
|
|
21
|
+
<text x="70" y="155" font-family="monospace" font-size="11" fill="#68d391">RABBITMQ_HOST</text>
|
|
22
|
+
<text x="250" y="155" font-family="Arial, sans-serif" font-size="11" fill="#e0e0e0">= "rabbitmq.example.com"</text>
|
|
23
|
+
<text x="70" y="170" font-family="monospace" font-size="11" fill="#68d391">RABBITMQ_PORT</text>
|
|
24
|
+
<text x="250" y="170" font-family="Arial, sans-serif" font-size="11" fill="#e0e0e0">= "5672"</text>
|
|
25
|
+
<text x="70" y="185" font-family="monospace" font-size="11" fill="#68d391">RABBITMQ_VHOST</text>
|
|
26
|
+
<text x="250" y="185" font-family="Arial, sans-serif" font-size="11" fill="#e0e0e0">= "/production"</text>
|
|
27
|
+
|
|
28
|
+
<text x="470" y="140" font-family="monospace" font-size="11" fill="#68d391">RABBITMQ_USERNAME</text>
|
|
29
|
+
<text x="650" y="140" font-family="Arial, sans-serif" font-size="11" fill="#e0e0e0">= "bunny_user"</text>
|
|
30
|
+
<text x="470" y="155" font-family="monospace" font-size="11" fill="#68d391">RABBITMQ_PASSWORD</text>
|
|
31
|
+
<text x="650" y="155" font-family="Arial, sans-serif" font-size="11" fill="#e0e0e0">= "secure_password"</text>
|
|
32
|
+
<text x="470" y="170" font-family="monospace" font-size="11" fill="#68d391">RABBITMQ_SSL</text>
|
|
33
|
+
<text x="650" y="170" font-family="Arial, sans-serif" font-size="11" fill="#e0e0e0">= "true"</text>
|
|
34
|
+
<text x="470" y="185" font-family="monospace" font-size="11" fill="#68d391">RABBITMQ_HEARTBEAT</text>
|
|
35
|
+
<text x="650" y="185" font-family="Arial, sans-serif" font-size="11" fill="#e0e0e0">= "30"</text>
|
|
36
|
+
</g>
|
|
37
|
+
|
|
38
|
+
<!-- BunnyFarm Specific Variables -->
|
|
39
|
+
<g>
|
|
40
|
+
<text x="450" y="250" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#9f7aea">
|
|
41
|
+
BunnyFarm Configuration Variables
|
|
42
|
+
</text>
|
|
43
|
+
|
|
44
|
+
<rect x="50" y="270" width="380" height="140" rx="6" fill="#2d3748" stroke="#9f7aea" stroke-width="1"/>
|
|
45
|
+
<text x="240" y="295" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" font-weight="bold" fill="#9f7aea">Exchange & Routing</text>
|
|
46
|
+
<text x="70" y="315" font-family="monospace" font-size="10" fill="#68d391">BUNNY_FARM_EXCHANGE</text>
|
|
47
|
+
<text x="70" y="330" font-family="Arial, sans-serif" font-size="10" fill="#e0e0e0">Default exchange name</text>
|
|
48
|
+
<text x="70" y="350" font-family="monospace" font-size="10" fill="#68d391">BUNNY_FARM_EXCHANGE_TYPE</text>
|
|
49
|
+
<text x="70" y="365" font-family="Arial, sans-serif" font-size="10" fill="#e0e0e0">Exchange type (topic, direct, fanout)</text>
|
|
50
|
+
<text x="70" y="385" font-family="monospace" font-size="10" fill="#68d391">BUNNY_FARM_ROUTING_KEY_PREFIX</text>
|
|
51
|
+
<text x="70" y="400" font-family="Arial, sans-serif" font-size="10" fill="#e0e0e0">Prefix for all routing keys</text>
|
|
52
|
+
|
|
53
|
+
<rect x="450" y="270" width="380" height="140" rx="6" fill="#2d3748" stroke="#f6e05e" stroke-width="1"/>
|
|
54
|
+
<text x="640" y="295" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" font-weight="bold" fill="#f6e05e">Error Handling</text>
|
|
55
|
+
<text x="470" y="315" font-family="monospace" font-size="10" fill="#68d391">BUNNY_FARM_RETRY_ATTEMPTS</text>
|
|
56
|
+
<text x="470" y="330" font-family="Arial, sans-serif" font-size="10" fill="#e0e0e0">Maximum retry attempts (default: 3)</text>
|
|
57
|
+
<text x="470" y="350" font-family="monospace" font-size="10" fill="#68d391">BUNNY_FARM_RETRY_DELAY</text>
|
|
58
|
+
<text x="470" y="365" font-family="Arial, sans-serif" font-size="10" fill="#e0e0e0">Initial retry delay in seconds</text>
|
|
59
|
+
<text x="470" y="385" font-family="monospace" font-size="10" fill="#68d391">BUNNY_FARM_DEAD_LETTER_QUEUE</text>
|
|
60
|
+
<text x="470" y="400" font-family="Arial, sans-serif" font-size="10" fill="#e0e0e0">Queue name for failed messages</text>
|
|
61
|
+
</g>
|
|
62
|
+
|
|
63
|
+
<!-- Usage Examples -->
|
|
64
|
+
<g>
|
|
65
|
+
<text x="450" y="450" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#e0e0e0">
|
|
66
|
+
Common Environment Variable Patterns
|
|
67
|
+
</text>
|
|
68
|
+
|
|
69
|
+
<rect x="50" y="470" width="260" height="25" rx="4" fill="#1a202c" stroke="#68d391" stroke-width="1"/>
|
|
70
|
+
<text x="180" y="487" text-anchor="middle" font-family="monospace" font-size="10" fill="#68d391">export RABBITMQ_URL="amqp://localhost:5672"</text>
|
|
71
|
+
|
|
72
|
+
<rect x="330" y="470" width="260" height="25" rx="4" fill="#1a202c" stroke="#4299e1" stroke-width="1"/>
|
|
73
|
+
<text x="460" y="487" text-anchor="middle" font-family="monospace" font-size="10" fill="#4299e1">export BUNNY_FARM_EXCHANGE="production"</text>
|
|
74
|
+
|
|
75
|
+
<rect x="610" y="470" width="260" height="25" rx="4" fill="#1a202c" stroke="#f6e05e" stroke-width="1"/>
|
|
76
|
+
<text x="740" y="487" text-anchor="middle" font-family="monospace" font-size="10" fill="#f6e05e">export BUNNY_FARM_RETRY_ATTEMPTS=5</text>
|
|
77
|
+
</g>
|
|
78
|
+
</svg>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<svg width="800" height="600" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect width="800" height="600" fill="transparent"/>
|
|
3
|
+
|
|
4
|
+
<!-- Title -->
|
|
5
|
+
<text x="400" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#e0e0e0">
|
|
6
|
+
Error Handling and Recovery Strategies
|
|
7
|
+
</text>
|
|
8
|
+
|
|
9
|
+
<!-- Main Flow -->
|
|
10
|
+
<g>
|
|
11
|
+
<!-- Message Processing -->
|
|
12
|
+
<rect x="50" y="80" width="140" height="60" rx="8" fill="#2d3748" stroke="#68d391" stroke-width="2"/>
|
|
13
|
+
<text x="120" y="105" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#68d391">Message</text>
|
|
14
|
+
<text x="120" y="120" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#68d391">Processing</text>
|
|
15
|
+
<text x="120" y="135" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#e0e0e0">message.process</text>
|
|
16
|
+
|
|
17
|
+
<!-- Decision Diamond -->
|
|
18
|
+
<polygon points="300,90 340,110 300,130 260,110" fill="#2d3748" stroke="#ff9800" stroke-width="2"/>
|
|
19
|
+
<text x="300" y="115" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" font-weight="bold" fill="#ff9800">Success?</text>
|
|
20
|
+
|
|
21
|
+
<!-- Success Path -->
|
|
22
|
+
<rect x="450" y="50" width="120" height="50" rx="6" fill="#2d3748" stroke="#68d391" stroke-width="2"/>
|
|
23
|
+
<text x="510" y="70" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#68d391">ACK</text>
|
|
24
|
+
<text x="510" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#e0e0e0">Message Complete</text>
|
|
25
|
+
|
|
26
|
+
<!-- Error Path -->
|
|
27
|
+
<rect x="380" y="160" width="140" height="60" rx="8" fill="#2d3748" stroke="#e53e3e" stroke-width="2"/>
|
|
28
|
+
<text x="450" y="185" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#e53e3e">Error Occurred</text>
|
|
29
|
+
<text x="450" y="200" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#e0e0e0">Exception raised</text>
|
|
30
|
+
<text x="450" y="215" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#e0e0e0">Log and categorize</text>
|
|
31
|
+
</g>
|
|
32
|
+
|
|
33
|
+
<!-- Error Types and Handling -->
|
|
34
|
+
<g>
|
|
35
|
+
<text x="400" y="270" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#e0e0e0">
|
|
36
|
+
Error Classification and Recovery
|
|
37
|
+
</text>
|
|
38
|
+
|
|
39
|
+
<!-- Transient Errors -->
|
|
40
|
+
<rect x="50" y="300" width="180" height="100" rx="8" fill="#2d3748" stroke="#f6e05e" stroke-width="2"/>
|
|
41
|
+
<text x="140" y="325" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" font-weight="bold" fill="#f6e05e">Transient Errors</text>
|
|
42
|
+
<text x="60" y="345" font-family="Arial, sans-serif" font-size="10" fill="#e0e0e0">• Network timeouts</text>
|
|
43
|
+
<text x="60" y="360" font-family="Arial, sans-serif" font-size="10" fill="#e0e0e0">• Database connection lost</text>
|
|
44
|
+
<text x="60" y="375" font-family="Arial, sans-serif" font-size="10" fill="#e0e0e0">• Rate limiting</text>
|
|
45
|
+
<text x="140" y="395" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" font-weight="bold" fill="#f6e05e">RETRY</text>
|
|
46
|
+
|
|
47
|
+
<!-- Permanent Errors -->
|
|
48
|
+
<rect x="250" y="300" width="180" height="100" rx="8" fill="#2d3748" stroke="#e53e3e" stroke-width="2"/>
|
|
49
|
+
<text x="340" y="325" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" font-weight="bold" fill="#e53e3e">Permanent Errors</text>
|
|
50
|
+
<text x="260" y="345" font-family="Arial, sans-serif" font-size="10" fill="#e0e0e0">• Invalid data format</text>
|
|
51
|
+
<text x="260" y="360" font-family="Arial, sans-serif" font-size="10" fill="#e0e0e0">• Authorization failed</text>
|
|
52
|
+
<text x="260" y="375" font-family="Arial, sans-serif" font-size="10" fill="#e0e0e0">• Business rule violation</text>
|
|
53
|
+
<text x="340" y="395" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" font-weight="bold" fill="#e53e3e">DEAD LETTER</text>
|
|
54
|
+
|
|
55
|
+
<!-- Unknown Errors -->
|
|
56
|
+
<rect x="450" y="300" width="180" height="100" rx="8" fill="#2d3748" stroke="#9f7aea" stroke-width="2"/>
|
|
57
|
+
<text x="540" y="325" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" font-weight="bold" fill="#9f7aea">Unknown Errors</text>
|
|
58
|
+
<text x="460" y="345" font-family="Arial, sans-serif" font-size="10" fill="#e0e0e0">• Unexpected exceptions</text>
|
|
59
|
+
<text x="460" y="360" font-family="Arial, sans-serif" font-size="10" fill="#e0e0e0">• New error conditions</text>
|
|
60
|
+
<text x="460" y="375" font-family="Arial, sans-serif" font-size="10" fill="#e0e0e0">• Code bugs</text>
|
|
61
|
+
<text x="540" y="395" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" font-weight="bold" fill="#9f7aea">RETRY + ALERT</text>
|
|
62
|
+
</g>
|
|
63
|
+
|
|
64
|
+
<!-- Recovery Strategies -->
|
|
65
|
+
<g>
|
|
66
|
+
<text x="400" y="450" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#e0e0e0">
|
|
67
|
+
Recovery Strategies
|
|
68
|
+
</text>
|
|
69
|
+
|
|
70
|
+
<!-- Circuit Breaker -->
|
|
71
|
+
<rect x="50" y="470" width="140" height="80" rx="6" fill="#1a202c" stroke="#4299e1" stroke-width="1"/>
|
|
72
|
+
<text x="120" y="490" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" font-weight="bold" fill="#4299e1">Circuit Breaker</text>
|
|
73
|
+
<text x="60" y="510" font-family="Arial, sans-serif" font-size="9" fill="#e0e0e0">Fail fast after</text>
|
|
74
|
+
<text x="60" y="525" font-family="Arial, sans-serif" font-size="9" fill="#e0e0e0">consecutive failures</text>
|
|
75
|
+
<text x="60" y="540" font-family="Arial, sans-serif" font-size="9" fill="#e0e0e0">Prevent cascade</text>
|
|
76
|
+
|
|
77
|
+
<!-- Dead Letter Queue -->
|
|
78
|
+
<rect x="210" y="470" width="140" height="80" rx="6" fill="#1a202c" stroke="#e53e3e" stroke-width="1"/>
|
|
79
|
+
<text x="280" y="490" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" font-weight="bold" fill="#e53e3e">Dead Letter Queue</text>
|
|
80
|
+
<text x="220" y="510" font-family="Arial, sans-serif" font-size="9" fill="#e0e0e0">Store failed messages</text>
|
|
81
|
+
<text x="220" y="525" font-family="Arial, sans-serif" font-size="9" fill="#e0e0e0">Manual inspection</text>
|
|
82
|
+
<text x="220" y="540" font-family="Arial, sans-serif" font-size="9" fill="#e0e0e0">Reprocess later</text>
|
|
83
|
+
|
|
84
|
+
<!-- Exponential Backoff -->
|
|
85
|
+
<rect x="370" y="470" width="140" height="80" rx="6" fill="#1a202c" stroke="#f6e05e" stroke-width="1"/>
|
|
86
|
+
<text x="440" y="490" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" font-weight="bold" fill="#f6e05e">Exponential Backoff</text>
|
|
87
|
+
<text x="380" y="510" font-family="Arial, sans-serif" font-size="9" fill="#e0e0e0">Increasing delays</text>
|
|
88
|
+
<text x="380" y="525" font-family="Arial, sans-serif" font-size="9" fill="#e0e0e0">2s, 4s, 8s, 16s...</text>
|
|
89
|
+
<text x="380" y="540" font-family="Arial, sans-serif" font-size="9" fill="#e0e0e0">Avoid thundering herd</text>
|
|
90
|
+
|
|
91
|
+
<!-- Monitoring -->
|
|
92
|
+
<rect x="530" y="470" width="140" height="80" rx="6" fill="#1a202c" stroke="#68d391" stroke-width="1"/>
|
|
93
|
+
<text x="600" y="490" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" font-weight="bold" fill="#68d391">Monitoring</text>
|
|
94
|
+
<text x="540" y="510" font-family="Arial, sans-serif" font-size="9" fill="#e0e0e0">Error rate tracking</text>
|
|
95
|
+
<text x="540" y="525" font-family="Arial, sans-serif" font-size="9" fill="#e0e0e0">Alerting thresholds</text>
|
|
96
|
+
<text x="540" y="540" font-family="Arial, sans-serif" font-size="9" fill="#e0e0e0">Health dashboards</text>
|
|
97
|
+
</g>
|
|
98
|
+
|
|
99
|
+
<!-- Flow arrows -->
|
|
100
|
+
<defs>
|
|
101
|
+
<marker id="arrow-error" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
|
|
102
|
+
<polygon points="0 0, 8 3, 0 6" fill="#ff9800"/>
|
|
103
|
+
</marker>
|
|
104
|
+
</defs>
|
|
105
|
+
|
|
106
|
+
<line x1="190" y1="110" x2="260" y2="110" stroke="#ff9800" stroke-width="2" marker-end="url(#arrow-error)"/>
|
|
107
|
+
<line x1="340" y1="100" x2="450" y2="75" stroke="#68d391" stroke-width="2" marker-end="url(#arrow-error)"/>
|
|
108
|
+
<text x="395" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#68d391">Yes</text>
|
|
109
|
+
|
|
110
|
+
<line x1="300" y1="130" x2="300" y2="150" stroke="#e53e3e" stroke-width="2"/>
|
|
111
|
+
<line x1="300" y1="150" x2="380" y2="150" stroke="#e53e3e" stroke-width="2"/>
|
|
112
|
+
<line x1="380" y1="150" x2="380" y2="160" stroke="#e53e3e" stroke-width="2" marker-end="url(#arrow-error)"/>
|
|
113
|
+
<text x="340" y="145" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#e53e3e">No</text>
|
|
114
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
🐰
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<svg width="800" height="500" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect width="800" height="500" fill="transparent"/>
|
|
3
|
+
|
|
4
|
+
<!-- Title -->
|
|
5
|
+
<text x="400" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#e0e0e0">
|
|
6
|
+
Fields DSL: Message Data Structure
|
|
7
|
+
</text>
|
|
8
|
+
|
|
9
|
+
<!-- Basic Field Definition -->
|
|
10
|
+
<g>
|
|
11
|
+
<text x="400" y="70" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#68d391">
|
|
12
|
+
Field Definition Syntax
|
|
13
|
+
</text>
|
|
14
|
+
|
|
15
|
+
<rect x="50" y="90" width="700" height="120" rx="8" fill="#2d3748" stroke="#68d391" stroke-width="2"/>
|
|
16
|
+
<text x="400" y="115" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#68d391">Message Class Example</text>
|
|
17
|
+
|
|
18
|
+
<text x="70" y="140" font-family="monospace" font-size="12" fill="#4299e1">class OrderMessage < BunnyFarm::Message</text>
|
|
19
|
+
<text x="80" y="160" font-family="monospace" font-size="12" fill="#68d391">fields</text>
|
|
20
|
+
<text x="140" y="160" font-family="monospace" font-size="12" fill="#e0e0e0">:order_id, :customer_id, :total_amount</text>
|
|
21
|
+
<text x="80" y="180" font-family="monospace" font-size="12" fill="#68d391">field</text>
|
|
22
|
+
<text x="130" y="180" font-family="monospace" font-size="12" fill="#e0e0e0">:items, default: []</text>
|
|
23
|
+
<text x="80" y="200" font-family="monospace" font-size="12" fill="#68d391">field</text>
|
|
24
|
+
<text x="130" y="200" font-family="monospace" font-size="12" fill="#e0e0e0">:status, default: 'pending'</text>
|
|
25
|
+
<text x="70" y="220" font-family="monospace" font-size="12" fill="#4299e1">end</text>
|
|
26
|
+
</g>
|
|
27
|
+
|
|
28
|
+
<!-- Field Types -->
|
|
29
|
+
<g>
|
|
30
|
+
<text x="400" y="260" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#e0e0e0">
|
|
31
|
+
Supported Field Types and Options
|
|
32
|
+
</text>
|
|
33
|
+
|
|
34
|
+
<!-- Simple Fields -->
|
|
35
|
+
<rect x="50" y="280" width="160" height="120" rx="6" fill="#2d3748" stroke="#4299e1" stroke-width="1"/>
|
|
36
|
+
<text x="130" y="305" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" font-weight="bold" fill="#4299e1">Simple Fields</text>
|
|
37
|
+
<text x="60" y="325" font-family="monospace" font-size="10" fill="#e0e0e0">:name # String</text>
|
|
38
|
+
<text x="60" y="340" font-family="monospace" font-size="10" fill="#e0e0e0">:age # Integer</text>
|
|
39
|
+
<text x="60" y="355" font-family="monospace" font-size="10" fill="#e0e0e0">:active # Boolean</text>
|
|
40
|
+
<text x="60" y="370" font-family="monospace" font-size="10" fill="#e0e0e0">:price # Float</text>
|
|
41
|
+
<text x="60" y="385" font-family="monospace" font-size="10" fill="#e0e0e0">:created_at # Time</text>
|
|
42
|
+
|
|
43
|
+
<!-- Complex Fields -->
|
|
44
|
+
<rect x="230" y="280" width="160" height="120" rx="6" fill="#2d3748" stroke="#9f7aea" stroke-width="1"/>
|
|
45
|
+
<text x="310" y="305" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" font-weight="bold" fill="#9f7aea">Complex Fields</text>
|
|
46
|
+
<text x="240" y="325" font-family="monospace" font-size="10" fill="#e0e0e0">:items # Array</text>
|
|
47
|
+
<text x="240" y="340" font-family="monospace" font-size="10" fill="#e0e0e0">:metadata # Hash</text>
|
|
48
|
+
<text x="240" y="355" font-family="monospace" font-size="10" fill="#e0e0e0">:customer # Object</text>
|
|
49
|
+
<text x="240" y="370" font-family="monospace" font-size="10" fill="#e0e0e0">:tags # Array</text>
|
|
50
|
+
<text x="240" y="385" font-family="monospace" font-size="10" fill="#e0e0e0">:settings # Hash</text>
|
|
51
|
+
|
|
52
|
+
<!-- Field Options -->
|
|
53
|
+
<rect x="410" y="280" width="160" height="120" rx="6" fill="#2d3748" stroke="#f6e05e" stroke-width="1"/>
|
|
54
|
+
<text x="490" y="305" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" font-weight="bold" fill="#f6e05e">Field Options</text>
|
|
55
|
+
<text x="420" y="325" font-family="monospace" font-size="10" fill="#e0e0e0">default: value</text>
|
|
56
|
+
<text x="420" y="340" font-family="monospace" font-size="10" fill="#e0e0e0">required: true</text>
|
|
57
|
+
<text x="420" y="355" font-family="monospace" font-size="10" fill="#e0e0e0">validate: proc</text>
|
|
58
|
+
<text x="420" y="370" font-family="monospace" font-size="10" fill="#e0e0e0">type: String</text>
|
|
59
|
+
<text x="420" y="385" font-family="monospace" font-size="10" fill="#e0e0e0">alias: :alt_name</text>
|
|
60
|
+
|
|
61
|
+
<!-- Access Patterns -->
|
|
62
|
+
<rect x="590" y="280" width="160" height="120" rx="6" fill="#2d3748" stroke="#e53e3e" stroke-width="1"/>
|
|
63
|
+
<text x="670" y="305" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" font-weight="bold" fill="#e53e3e">Access Patterns</text>
|
|
64
|
+
<text x="600" y="325" font-family="monospace" font-size="10" fill="#e0e0e0">msg[:field_name]</text>
|
|
65
|
+
<text x="600" y="340" font-family="monospace" font-size="10" fill="#e0e0e0">msg.field_name</text>
|
|
66
|
+
<text x="600" y="355" font-family="monospace" font-size="10" fill="#e0e0e0">msg.field_name=</text>
|
|
67
|
+
<text x="600" y="370" font-family="monospace" font-size="10" fill="#e0e0e0">msg.fields</text>
|
|
68
|
+
<text x="600" y="385" font-family="monospace" font-size="10" fill="#e0e0e0">msg.to_h</text>
|
|
69
|
+
</g>
|
|
70
|
+
|
|
71
|
+
<!-- Usage Example -->
|
|
72
|
+
<g>
|
|
73
|
+
<text x="400" y="440" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#e0e0e0">
|
|
74
|
+
Usage Example
|
|
75
|
+
</text>
|
|
76
|
+
|
|
77
|
+
<rect x="50" y="460" width="340" height="70" rx="6" fill="#1a202c" stroke="#68d391" stroke-width="1"/>
|
|
78
|
+
<text x="220" y="480" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#68d391">Creating and Setting Fields</text>
|
|
79
|
+
<text x="60" y="500" font-family="monospace" font-size="10" fill="#e0e0e0">message = OrderMessage.new</text>
|
|
80
|
+
<text x="60" y="515" font-family="monospace" font-size="10" fill="#e0e0e0">message[:order_id] = 12345</text>
|
|
81
|
+
<text x="60" y="530" font-family="monospace" font-size="10" fill="#e0e0e0">message.customer_id = "cust_456"</text>
|
|
82
|
+
|
|
83
|
+
<rect x="410" y="460" width="340" height="70" rx="6" fill="#1a202c" stroke="#4299e1" stroke-width="1"/>
|
|
84
|
+
<text x="580" y="480" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#4299e1">Reading and Validation</text>
|
|
85
|
+
<text x="420" y="500" font-family="monospace" font-size="10" fill="#e0e0e0">puts message[:order_id] # 12345</text>
|
|
86
|
+
<text x="420" y="515" font-family="monospace" font-size="10" fill="#e0e0e0">puts message.valid? # true/false</text>
|
|
87
|
+
<text x="420" y="530" font-family="monospace" font-size="10" fill="#e0e0e0">puts message.errors # validation errors</text>
|
|
88
|
+
</g>
|
|
89
|
+
</svg>
|