Class: AceMQ::Rails::Railtie

Inherits:
Rails::Railtie
  • Object
show all
Defined in:
lib/acemq/rails/railtie.rb

Overview

Wires AceMQ into a Rails application.

A Railtie rather than an Engine, because this contributes no routes, no views, no models and no migrations. An Engine would add a mount point nobody mounts and an app/ tree nobody fills.

It does four things, in this order:

  1. Reads config/acemq.yml through Rails' own config_for, and puts what it finds under config.acemq so that an environment file can override any of it.
  2. Builds Configuration from the result, once, after every initializer has had its say.
  3. Adds app/consumers to the autoload paths.
  4. Registers the rake tasks and an at_exit that closes the connection.

It starts no consumers. That is the whole design and it is enforced here rather than merely recommended: nothing in this file subscribes to anything, so a consumer cannot accidentally end up inside Puma.