Sha256: 48d4766f5261ea64c0f3df24dfd57538470be839a7ed1079cc928fadac15e92d

Contents?: true

Size: 725 Bytes

Versions: 5

Compression:

Stored size: 725 Bytes

Contents

require "forwardable"
module Queuel
  module SQS
    class Engine < Base::Engine
      extend Forwardable
      def_delegators :Queuel, :logger

      AWSSDKMissingError = Class.new(StandardError)

      def queue(which_queue)
        memoized_queues[which_queue.to_s] ||= queue_klass.new(client, which_queue, credentials)
      end

      private


      def client_klass
        if defined?(::AWS::SQS)
          ::AWS::SQS
        else
          begin
            logger.info "Loading AWS SDK..."
            require 'aws-sdk'
            ::AWS::SQS
          rescue LoadError
            logger.error "Couldn't find aws_sdk gem"
            raise(AWSSDKMissingError)
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
queuel-0.4.4 lib/queuel/sqs/engine.rb
queuel-0.4.3 lib/queuel/sqs/engine.rb
queuel-0.4.2 lib/queuel/sqs/engine.rb
queuel-0.4.1 lib/queuel/sqs/engine.rb
queuel-0.4.0 lib/queuel/sqs/engine.rb