Skip to content

Auto-loading consumers from a Rails 6 app requires using classic autoloader #331

@jtrees

Description

@jtrees

Summary

Currently Hutch does not work with Rails 6 (rc1) out-of-the-box since the latter defaults to using Zeitwerk for autoloading paths.

Steps to Reproduce

  1. Generate a new Rails 6 application.
  2. Add hutch as a dependency.
  3. Create a consumer under <rails_root>/app/consumers/foo_consumer.rb.
  4. Ensure RabbitMQ is running.
  5. Run Hutch from the Rails root directory like so: bundle exec hutch --autoload-rails

Expected Result

The output should include lines such as these:

2019-07-01T15:54:24Z 6 INFO -- found rails project (.), booting app in development environment
<...>
2019-07-01T15:54:24Z 6 INFO -- setting up queues
2019-07-01T15:54:24Z 6 INFO -- setting up queue: consumers:foo_consumer

Actual Result

The output looks more like this:

2019-07-01T15:47:48Z 6 INFO -- found rails project (.), booting app in development environment
<...>
2019-07-01T15:47:48Z 6 WARN -- no consumer loaded, ensure there's no configuration issue
2019-07-01T15:47:48Z 6 INFO -- setting up queues

Known Workaround

Add the following to <rails_root>/config/application.rb:

config.autoloader = :classic

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions