Class: Sbmt::Outbox::V2::Tasks::Poll

Inherits:
Base
  • Object
show all
Defined in:
lib/sbmt/outbox/v2/tasks/poll.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#item_class, #log_tags, #worker_name, #worker_version, #yabeda_labels

Instance Method Summary collapse

Methods inherited from Base

#to_h

Constructor Details

#initialize(item_class:, worker_name:, partition:, buckets:) ⇒ Poll

Returns a new instance of Poll.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/sbmt/outbox/v2/tasks/poll.rb', line 12

def initialize(item_class:, worker_name:, partition:, buckets:)
  super(item_class: item_class, worker_name: worker_name)

  @partition = partition
  @buckets = buckets

  @resource_key = "#{item_class.box_name}:#{partition}"
  @resource_path = "sbmt:outbox:#{worker_name}:#{resource_key}"
  @redis_queue = "#{item_class.box_name}:job_queue"

  @log_tags = log_tags.merge(box_partition: partition)

  @yabeda_labels = yabeda_labels.merge(partition: partition)
end

Instance Attribute Details

#bucketsObject (readonly)

Returns the value of attribute buckets.



10
11
12
# File 'lib/sbmt/outbox/v2/tasks/poll.rb', line 10

def buckets
  @buckets
end

#partitionObject (readonly)

Returns the value of attribute partition.



10
11
12
# File 'lib/sbmt/outbox/v2/tasks/poll.rb', line 10

def partition
  @partition
end

#redis_queueObject (readonly)

Returns the value of attribute redis_queue.



10
11
12
# File 'lib/sbmt/outbox/v2/tasks/poll.rb', line 10

def redis_queue
  @redis_queue
end

#resource_keyObject (readonly)

Returns the value of attribute resource_key.



10
11
12
# File 'lib/sbmt/outbox/v2/tasks/poll.rb', line 10

def resource_key
  @resource_key
end

#resource_pathObject (readonly)

Returns the value of attribute resource_path.



10
11
12
# File 'lib/sbmt/outbox/v2/tasks/poll.rb', line 10

def resource_path
  @resource_path
end

Instance Method Details

#to_sObject



27
28
29
# File 'lib/sbmt/outbox/v2/tasks/poll.rb', line 27

def to_s
  resource_path
end