Class: Tackle::Consumer::Params

Inherits:
Object
  • Object
show all
Defined in:
lib/tackle/consumer/params.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Params

Returns a new instance of Params.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/tackle/consumer/params.rb', line 16

def initialize(params = {})
  # required
  @amqp_url    = params.fetch(:url)
  @exchange    = params.fetch(:exchange)
  @routing_key = params.fetch(:routing_key)
  @service     = params.fetch(:service)

  # optional
  @retry_limit = params[:retry_limit] || 8
  @retry_delay = params[:retry_delay] || 30
  @logger      = params[:logger] || Logger.new(STDOUT)
  @manual_ack  = params.fetch(:manual_ack, false)

  @exception_handler = params[:exception_handler]

  @connection  = params.fetch(:connection, nil)
end

Instance Attribute Details

#amqp_urlObject (readonly)

Returns the value of attribute amqp_url.



5
6
7
# File 'lib/tackle/consumer/params.rb', line 5

def amqp_url
  @amqp_url
end

#connectionObject (readonly)

Returns the value of attribute connection.



14
15
16
# File 'lib/tackle/consumer/params.rb', line 14

def connection
  @connection
end

#exception_handlerObject (readonly)

Returns the value of attribute exception_handler.



12
13
14
# File 'lib/tackle/consumer/params.rb', line 12

def exception_handler
  @exception_handler
end

#exchangeObject (readonly)

Returns the value of attribute exchange.



6
7
8
# File 'lib/tackle/consumer/params.rb', line 6

def exchange
  @exchange
end

#loggerObject (readonly)

Returns the value of attribute logger.



11
12
13
# File 'lib/tackle/consumer/params.rb', line 11

def logger
  @logger
end

#manual_ackObject (readonly)

Returns the value of attribute manual_ack.



13
14
15
# File 'lib/tackle/consumer/params.rb', line 13

def manual_ack
  @manual_ack
end

#retry_delayObject (readonly)

Returns the value of attribute retry_delay.



10
11
12
# File 'lib/tackle/consumer/params.rb', line 10

def retry_delay
  @retry_delay
end

#retry_limitObject (readonly)

Returns the value of attribute retry_limit.



9
10
11
# File 'lib/tackle/consumer/params.rb', line 9

def retry_limit
  @retry_limit
end

#routing_keyObject (readonly)

Returns the value of attribute routing_key.



7
8
9
# File 'lib/tackle/consumer/params.rb', line 7

def routing_key
  @routing_key
end

#serviceObject (readonly)

Returns the value of attribute service.



8
9
10
# File 'lib/tackle/consumer/params.rb', line 8

def service
  @service
end

Instance Method Details

#manual_ack?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/tackle/consumer/params.rb', line 34

def manual_ack?
  @manual_ack == true
end