module EventQ::WorkerId

Module to be used by concrete worker classes to tag each thread working on a message Allows to be used in custom logging to track group of log messages per queue message processing.

Public Instance Methods

tag_processing_thread() click to toggle source
# File lib/eventq_base/worker_id.rb, line 5
def tag_processing_thread
  Thread.current[key_name] = SecureRandom.uuid
end
untag_processing_thread() click to toggle source
# File lib/eventq_base/worker_id.rb, line 9
def untag_processing_thread
  Thread.current[key_name] = nil
end

Private Instance Methods

key_name() click to toggle source
# File lib/eventq_base/worker_id.rb, line 15
def key_name
  'worker_id'.freeze
end