Sha256: 39f5720e5b1332a77741acaf220cbcc324195f85bdd98ea995476b389692c90f

Contents?: true

Size: 1.05 KB

Versions: 16

Compression:

Stored size: 1.05 KB

Contents

module DispatchRider
  class Configuration
    attr_accessor :handler_path, :error_handler, :queue_info, :queue_kind, :subscriber, :logger
    attr_reader :callbacks

    def initialize
      @handler_path = Dir.getwd + "/app/handlers"
      @error_handler = DispatchRider::DefaultErrorHandler
      @queue_kind = :file_system
      @queue_info = { path: "tmp/dispatch-rider-queue" }
      @callbacks = Callbacks::Storage.new
      @subscriber = DispatchRider::Subscriber
      @logger = Logger.new(STDERR)
    end

    delegate :before, :after, :around, :to => :callbacks
    
    def default_retry_timeout=(val)
      DispatchRider::Handlers::Base.set_default_retry(val)
    end

    def handlers
      @handlers ||= begin
                      load_handler_files
                      DispatchRider::Handlers::Base.subclasses.map{ |klass| klass.name.underscore.to_sym }
                    end
    end

    private

    def load_handler_files
      Dir["#{@handler_path}/*.rb"].each do |filename|
        require filename.gsub(/\.rb$/, '')
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
dispatch-rider-1.2.11 lib/dispatch-rider/configuration.rb
dispatch-rider-1.2.10 lib/dispatch-rider/configuration.rb
dispatch-rider-1.2.9 lib/dispatch-rider/configuration.rb
dispatch-rider-1.2.8 lib/dispatch-rider/configuration.rb
dispatch-rider-1.2.7 lib/dispatch-rider/configuration.rb
dispatch-rider-1.2.6 lib/dispatch-rider/configuration.rb
dispatch-rider-1.2.5 lib/dispatch-rider/configuration.rb
dispatch-rider-1.2.4 lib/dispatch-rider/configuration.rb
dispatch-rider-1.2.3 lib/dispatch-rider/configuration.rb
dispatch-rider-1.2.2 lib/dispatch-rider/configuration.rb
dispatch-rider-1.2.1 lib/dispatch-rider/configuration.rb
dispatch-rider-1.2.0 lib/dispatch-rider/configuration.rb
dispatch-rider-1.1.7 lib/dispatch-rider/configuration.rb
dispatch-rider-1.1.6 lib/dispatch-rider/configuration.rb
dispatch-rider-1.1.5 lib/dispatch-rider/configuration.rb
dispatch-rider-1.1.4 lib/dispatch-rider/configuration.rb