Class: BBK::HTTP::MessageConsumerBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/bbk/http/message_consumer_builder.rb

Instance Method Summary collapse

Constructor Details

#initializeMessageConsumerBuilder

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

#buildObject

Raises:

  • (ArgumentError)


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

Raises:

  • (ArgumentError)


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

Raises:

  • (ArgumentError)


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