Class: Gcpc::Interceptors::Subscriber::CheckDupInterceptor
- Inherits:
-
Subscriber::BaseInterceptor
- Object
- Subscriber::BaseInterceptor
- Gcpc::Interceptors::Subscriber::CheckDupInterceptor
- Defined in:
- lib/gcpc/interceptors/subscriber/check_dup_interceptor.rb
Overview
‘CheckOrderInterceptor` checks the duplication of messages.
Defined Under Namespace
Classes: BaseStrategy
Instance Method Summary collapse
- #handle(data, attributes, message, &block) {|data, attributes, message| ... } ⇒ Object
-
#initialize(store:, strategy: BaseStrategy.new) ⇒ CheckDupInterceptor
constructor
A new instance of CheckDupInterceptor.
Constructor Details
#initialize(store:, strategy: BaseStrategy.new) ⇒ CheckDupInterceptor
Returns a new instance of CheckDupInterceptor.
28 29 30 31 |
# File 'lib/gcpc/interceptors/subscriber/check_dup_interceptor.rb', line 28 def initialize(store:, strategy: BaseStrategy.new) @store = store @strategy = strategy end |
Instance Method Details
#handle(data, attributes, message, &block) {|data, attributes, message| ... } ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/gcpc/interceptors/subscriber/check_dup_interceptor.rb', line 37 def handle(data, attributes, , &block) id = @strategy.id(data, attributes, ) if !id.nil? && duplicated?(id) @strategy.on_dup(data, attributes, , &block) return end yield data, attributes, end |