Class: BBK::HTTP::MessageConsumerBuilder
- Inherits:
-
Object
- Object
- BBK::HTTP::MessageConsumerBuilder
- Defined in:
- lib/bbk/http/message_consumer_builder.rb
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize ⇒ MessageConsumerBuilder
constructor
A new instance of MessageConsumerBuilder.
- #with_ack_action(&block) ⇒ Object
- #with_nack_action(&block) ⇒ Object
Constructor Details
#initialize ⇒ MessageConsumerBuilder
Returns a new instance of MessageConsumerBuilder.
7 8 9 10 |
# File 'lib/bbk/http/message_consumer_builder.rb', line 7 def initialize @ack_action = nil @nack_action = nil end |
Instance Method Details
#build ⇒ Object
26 27 28 29 30 31 |
# File 'lib/bbk/http/message_consumer_builder.rb', line 26 def build raise ArgumentError.new('Empty ack action funtion') if @ack_action.nil? raise ArgumentError.new('Empty nack action function') if @nack_action.nil? MessageConsumer.new(@ack_action, @nack_action) end |
#with_ack_action(&block) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/bbk/http/message_consumer_builder.rb', line 12 def with_ack_action(&block) raise ArgumentError.new('Empty block') unless block_given? @ack_action = block self end |
#with_nack_action(&block) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/bbk/http/message_consumer_builder.rb', line 19 def with_nack_action(&block) raise ArgumentError.new('Empty block') unless block_given? @nack_action = block self end |