Skip to content

Commit 73fbce9

Browse files
committed
Add middleware pattern, Event object support, and test helpers
Features Added: - Middleware pattern for consumers with 5 built-in middleware classes * LoggingMiddleware * ErrorHandlingMiddleware * MetricsMiddleware * TracingMiddleware * TimeoutMiddleware - Consumer now provides Event objects to handlers with backwards compatibility - Handler arity detection for seamless migration - Comprehensive test helpers module with RSpec matchers - Updated documentation Breaking Changes: None (100% backwards compatible) The Consumer now supports middleware and provides structured Event objects to handlers while maintaining backwards compatibility with the old (hash, subject, deliveries) signature through arity detection.
1 parent ef4701d commit 73fbce9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+5827
-1721
lines changed

.rubocop.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,19 @@ Metrics/AbcSize:
6666

6767
Metrics/CyclomaticComplexity:
6868
Max: 10
69+
Exclude:
70+
- "lib/jetstream_bridge/models/event.rb" # Hash-like [] accessor with many keys
71+
- "lib/jetstream_bridge/test_helpers.rb" # Test helper with complex setup
6972

7073
Metrics/PerceivedComplexity:
7174
Max: 10
75+
Exclude:
76+
- "lib/jetstream_bridge/test_helpers.rb" # Test helper with complex setup
77+
78+
Metrics/ModuleLength:
79+
Max: 100
80+
Exclude:
81+
- "lib/jetstream_bridge.rb" # Main module with convenience methods
7282

7383
Metrics/ClassLength:
7484
Max: 200
@@ -84,7 +94,27 @@ Naming/PredicateMethod:
8494
- validate_component!
8595
- publish_to_nats
8696

97+
Naming/PredicatePrefix:
98+
Enabled: true
99+
Exclude:
100+
- "lib/jetstream_bridge/test_helpers.rb" # RSpec matcher convention uses have_*
101+
87102
# ---------- Lint ----------
103+
Lint/EmptyClass:
104+
Enabled: true
105+
Exclude:
106+
- "lib/jetstream_bridge/consumer/middleware.rb" # Forward declaration for circular dependency
107+
108+
Lint/EmptyBlock:
109+
Enabled: true
110+
Exclude:
111+
- "spec/**/*" # Empty blocks in tests are intentional for testing error handling
112+
113+
Lint/UnusedBlockArgument:
114+
Enabled: true
115+
Exclude:
116+
- "spec/**/*" # Test mocks may not use all arguments
117+
88118
Lint/IneffectiveAccessModifier:
89119
Enabled: false # Allow class methods after private
90120

API_IMPROVEMENTS_SUMMARY.md

Lines changed: 0 additions & 350 deletions
This file was deleted.

0 commit comments

Comments
 (0)