Module: Leveret
- Defined in:
- lib/leveret.rb,
lib/leveret/cli.rb,
lib/leveret/job.rb,
lib/leveret/queue.rb,
lib/leveret/worker.rb,
lib/leveret/message.rb,
lib/leveret/version.rb,
lib/leveret/parameters.rb,
lib/leveret/delay_queue.rb,
lib/leveret/configuration.rb,
lib/leveret/log_formatter.rb,
lib/leveret/result_handler.rb
Overview
Top level module, contains things that are required globally by Leveret, such as configuration, the RabbitMQ channel and the logger.
Defined Under Namespace
Modules: Job Classes: CLI, Configuration, DelayQueue, LogFormatter, Message, Parameters, Queue, ResultHandler, Worker
Constant Summary collapse
- VERSION =
"0.1.6".freeze
Class Attribute Summary collapse
-
.configuration ⇒ Configuration
The current configuration of Leveret.
Class Method Summary collapse
- .channel ⇒ Bunny::Channel
-
.configure {|config| ... } ⇒ Object
Allows leveret to be configured via a block.
- .delay_queue ⇒ Object
-
.exchange ⇒ Bunny::Exchange
Connect to the RabbitMQ exchange that Leveret uses, used by the Queue for publishing and subscribing, not recommended for general use.
-
.log ⇒ Logger
Logger used throughout Leveret, see Configuration for config options.
- .reset_connection! ⇒ Object
Class Attribute Details
.configuration ⇒ Configuration
Returns The current configuration of Leveret.
25 26 27 |
# File 'lib/leveret.rb', line 25 def configuration @configuration ||= Configuration.new end |
Class Method Details
.channel ⇒ Bunny::Channel
52 53 54 55 56 57 58 |
# File 'lib/leveret.rb', line 52 def channel @channel ||= begin chan = mq_connection.create_channel chan.prefetch(configuration.concurrent_fork_count) chan end end |
.configure {|config| ... } ⇒ Object
Allows leveret to be configured via a block
33 34 35 |
# File 'lib/leveret.rb', line 33 def configure yield(configuration) if block_given? end |
.delay_queue ⇒ Object
60 61 62 |
# File 'lib/leveret.rb', line 60 def delay_queue @delay_queue ||= Leveret::DelayQueue.new end |
.exchange ⇒ Bunny::Exchange
Connect to the RabbitMQ exchange that Leveret uses, used by the Queue for publishing and subscribing, not recommended for general use.
42 43 44 45 |
# File 'lib/leveret.rb', line 42 def exchange @exchange ||= channel.exchange(Leveret.configuration.exchange_name, type: :direct, durable: true, auto_delete: false) end |
.log ⇒ Logger
Logger used throughout Leveret, see Configuration for config options.
73 74 75 76 77 78 79 |
# File 'lib/leveret.rb', line 73 def log @log ||= Logger.new(configuration.log_file).tap do |log| log.level = configuration.log_level log.progname = 'Leveret' log.formatter = Leveret::LogFormatter.new end end |
.reset_connection! ⇒ Object
64 65 66 67 68 |
# File 'lib/leveret.rb', line 64 def reset_connection! @mq_connection = nil @channel = nil @delay_queue = nil end |