Sha256: 9375743011decb96c7d8d63a8f6d9bba7c408cfa5e954b47ac5cdc3412c56618

Contents?: true

Size: 1.42 KB

Versions: 2

Compression:

Stored size: 1.42 KB

Contents

module Jobi
  module Config
    class Rabbitmq
      attr_accessor :host, :port, :user, :pass, :vhost,
                    :heartbeat, :automatically_recover,
                    :network_recovery_interval, :threaded, :ssl,
                    :continuation_timeout, :frame_max, :auth_mechanism

      def initialize
        setup_server_config
        setup_network_config
        setup_processing_config
      end

      def to_h
        {
          host: @host,
          port: @port,
          user: @user,
          pass: @pass,
          vhost: @vhost,
          auth_mechanism: @auth_mechanism,
          heartbeat: @heartbeat,
          automatically_recover: @automatically_recover,
          network_recovery_interval: @network_recovery_interval,
          ssl: @ssl,
          threaded: @threaded,
          continuation_timeout: @continuation_timeout,
          frame_max: @frame_max
        }
      end

      private

      def setup_server_config
        @host = '127.0.0.1'
        @port = '5672'
        @user = 'guest'
        @pass = 'guest'
        @vhost = '/'
        @auth_mechanism = 'PLAIN'
      end

      def setup_network_config
        @heartbeat = :server
        @automatically_recover = true
        @network_recovery_interval = 5.0
        @ssl = false
      end

      def setup_processing_config
        @threaded = true
        @continuation_timeout = 4000
        @frame_max = 131_072
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jobi-0.2.1 lib/jobi/config/rabbitmq.rb
jobi-0.1.1 lib/jobi/config/rabbitmq.rb