Class: Alephant::Publisher::Queue::SQSHelper::Queue

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
lib/alephant/publisher/queue/sqs_helper/queue.rb

Constant Summary collapse

WAIT_TIME =
5
VISABILITY_TIMEOUT =
300

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(queue, archiver = nil, timeout = VISABILITY_TIMEOUT, wait_time = WAIT_TIME) ⇒ Queue

Returns a new instance of Queue.



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/alephant/publisher/queue/sqs_helper/queue.rb', line 16

def initialize(
  queue,
  archiver  = nil,
  timeout   = VISABILITY_TIMEOUT,
  wait_time = WAIT_TIME
)
  @queue     = queue
  @archiver  = archiver
  @timeout   = timeout
  @wait_time = wait_time
  log_queue_creation queue.url, archiver, timeout
end

Instance Attribute Details

#archiverObject (readonly)

Returns the value of attribute archiver.



14
15
16
# File 'lib/alephant/publisher/queue/sqs_helper/queue.rb', line 14

def archiver
  @archiver
end

#queueObject (readonly)

Returns the value of attribute queue.



14
15
16
# File 'lib/alephant/publisher/queue/sqs_helper/queue.rb', line 14

def queue
  @queue
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



14
15
16
# File 'lib/alephant/publisher/queue/sqs_helper/queue.rb', line 14

def timeout
  @timeout
end

#wait_timeObject (readonly)

Returns the value of attribute wait_time.



14
15
16
# File 'lib/alephant/publisher/queue/sqs_helper/queue.rb', line 14

def wait_time
  @wait_time
end

Instance Method Details

#messageObject



29
30
31
# File 'lib/alephant/publisher/queue/sqs_helper/queue.rb', line 29

def message
  receive.tap { |m| process(m) unless m.nil? }
end