Class: Gcpc::Interceptors::Subscriber::CheckOrderInterceptor
- Inherits:
-
Subscriber::BaseInterceptor
- Object
- Subscriber::BaseInterceptor
- Gcpc::Interceptors::Subscriber::CheckOrderInterceptor
- Defined in:
- lib/gcpc/interceptors/subscriber/check_order_interceptor.rb
Overview
‘CheckOrderInterceptor` checks the order of messages in each group.
Defined Under Namespace
Classes: BaseStrategy
Instance Method Summary collapse
- #handle(data, attributes, message, &block) {|data, attributes, message| ... } ⇒ Object
-
#initialize(store:, logger: Logger.new(STDOUT), strategy: BaseStrategy.new) ⇒ CheckOrderInterceptor
constructor
A new instance of CheckOrderInterceptor.
Constructor Details
#initialize(store:, logger: Logger.new(STDOUT), strategy: BaseStrategy.new) ⇒ CheckOrderInterceptor
Returns a new instance of CheckOrderInterceptor.
59 60 61 62 63 |
# File 'lib/gcpc/interceptors/subscriber/check_order_interceptor.rb', line 59 def initialize(store:, logger: Logger.new(STDOUT), strategy: BaseStrategy.new) @store = store @logger = logger @strategy = strategy end |
Instance Method Details
#handle(data, attributes, message, &block) {|data, attributes, message| ... } ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/gcpc/interceptors/subscriber/check_order_interceptor.rb', line 69 def handle(data, attributes, , &block) = @strategy.(data, attributes, ) if .nil? yield data, attributes, return end group_id = @strategy.group_id(data, attributes, ) if swapped?(group_id, ) @strategy.on_swapped(data, attributes, , &block) return end yield data, attributes, end |