Module: MicroQ

Defined in:
lib/micro_q.rb,
lib/micro_q/cli.rb,
lib/micro_q/dsl.rb,
lib/micro_q/util.rb,
lib/micro_q/redis.rb,
lib/micro_q/config.rb,
lib/micro_q/inspect.rb,
lib/micro_q/version.rb,
lib/micro_q/queue/sqs.rb,
lib/micro_q/sqs_client.rb,
lib/micro_q/queue/redis.rb,
lib/micro_q/fetchers/sqs.rb,
lib/micro_q/proxies/base.rb,
lib/micro_q/methods/class.rb,
lib/micro_q/proxies/class.rb,
lib/micro_q/queue/default.rb,
lib/micro_q/manager/default.rb,
lib/micro_q/middleware/util.rb,
lib/micro_q/statistics/base.rb,
lib/micro_q/worker/standard.rb,
lib/micro_q/methods/instance.rb,
lib/micro_q/middleware/chain.rb,
lib/micro_q/proxies/instance.rb,
lib/micro_q/statistics/redis.rb,
lib/micro_q/statistics/default.rb,
lib/micro_q/methods/action_mailer.rb,
lib/micro_q/methods/active_record.rb,
lib/micro_q/proxies/action_mailer.rb,
lib/micro_q/wrappers/action_mailer.rb,
lib/micro_q/middleware/server/retry.rb,
lib/micro_q/middleware/server/timeout.rb,
lib/micro_q/middleware/client/statistics.rb,
lib/micro_q/middleware/server/connection.rb,
lib/micro_q/middleware/server/statistics.rb

Defined Under Namespace

Modules: DSL, Fetcher, Inspect, Manager, Methods, Middleware, Proxy, Queue, Statistics, Util, Worker, Wrapper Classes: CLI, Config, SqsClient

Constant Summary collapse

MAJOR =
0
MINOR =
9
POINT =
6
VERSION =
[MAJOR, MINOR, POINT].join('.')

Class Method Summary collapse

Class Method Details

.configObject



12
13
14
# File 'lib/micro_q.rb', line 12

def self.config
  @config ||= Config.new
end

.configure {|config| ... } ⇒ Object

Yields:



16
17
18
# File 'lib/micro_q.rb', line 16

def self.configure
  yield config
end

.middlewareObject



20
21
22
# File 'lib/micro_q.rb', line 20

def self.middleware
  config.middleware
end

.push(*args) ⇒ Object



32
33
34
# File 'lib/micro_q.rb', line 32

def self.push(*args)
  manager.queue.push(*args)
end

.queue_only?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/micro_q.rb', line 36

def self.queue_only?
  @queue_only ||= MicroQ.config.sqs? && !MicroQ.config.worker_mode?
end

.redisObject



2
3
4
5
6
# File 'lib/micro_q/redis.rb', line 2

def self.redis
  redis_connection.with do |r|
    yield r
  end
end

.redis_connectionObject



8
9
10
11
12
13
14
# File 'lib/micro_q/redis.rb', line 8

def self.redis_connection
  @@redis_connection ||= begin
    ::ConnectionPool.new(config.redis_pool) do
      ::Redis.new(config.redis)
    end
  end
end

.startObject



28
29
30
# File 'lib/micro_q.rb', line 28

def self.start
  manager
end

.stats(&block) ⇒ Object



24
25
26
# File 'lib/micro_q.rb', line 24

def self.stats(&block)
  config.statistics.stats(&block)
end