Sha256: 53e0952d2da261ddfc861f082b5351c4b4269be9c65c0d88d6edd8e50de93375

Contents?: true

Size: 359 Bytes

Versions: 7

Compression:

Stored size: 359 Bytes

Contents

module Jackhammer
  class QueueName
    def self.app_name
      Jackhammer.configuration.app_name
    end

    def self.from_routing_key(routing_key)
      fail(InvalidConfigError, "app_name must be set to determine queue_name from routing_key") if app_name.to_s.empty?

      "#{app_name}_#{routing_key}_q".gsub(/[^\w]+/, '_').squeeze('_')
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
jackhammer-1.5.1 lib/jackhammer/queue_name.rb
jackhammer-1.5.0 lib/jackhammer/queue_name.rb
jackhammer-1.5.0.rc lib/jackhammer/queue_name.rb
jackhammer-1.4.0 lib/jackhammer/queue_name.rb
jackhammer-1.3.7 lib/jackhammer/queue_name.rb
jackhammer-1.3.6 lib/jackhammer/queue_name.rb
jackhammer-1.3.5 lib/jackhammer/queue_name.rb