Ruby on Rails Error Using Sneakers with RabbitMQ
<p>I am using sneakers gem to trigger actions on RabbitMQ
But i can not start my service for triggering</p>

<p>I run the command </p>

<pre><code>WORKERS=MailerWorker rake sneakers:run
</code></pre>

<p>and I got the error as </p>

<pre><code>[INFO] 160825 14:26:46 :: LAUNCH worker
rake aborted!
NameError: uninitialized constant ApplicationCable::ActionCable
/home/hdthinh/wthapps/admin-api/app/channels/application_cable/channel.rb:3:in `&lt;module:ApplicationCable&gt;'
/home/hdthinh/wthapps/admin-api/app/channels/application_cable/channel.rb:2:in `&lt;top (required)&gt;'
/home/hdthinh/.rvm/gems/ruby-2.3.0/bundler/gems/rails-804f5b3c2af9/activesupport/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
/home/hdthinh/.rvm/gems/ruby-2.3.0/bundler/gems/rails-804f5b3c2af9/activesupport/lib/active_support/concurrency/share_lock.rb:149:in `exclusive'
/home/hdthinh/.rvm/gems/ruby-2.3.0/bundler/gems/rails-804f5b3c2af9/activesupport/lib/active_support/dependencies/interlock.rb:11:in `loading'
/home/hdthinh/.rvm/gems/ruby-2.3.0/bundler/gems/rails-804f5b3c2af9/railties/lib/rails/engine.rb:476:in `block (2 levels) in eager_load!'
/home/hdthinh/.rvm/gems/ruby-2.3.0/bundler/gems/rails-804f5b3c2af9/railties/lib/rails/engine.rb:475:in `each'
/home/hdthinh/.rvm/gems/ruby-2.3.0/bundler/gems/rails-804f5b3c2af9/railties/lib/rails/engine.rb:475:in `block in eager_load!'
/home/hdthinh/.rvm/gems/ruby-2.3.0/bundler/gems/rails-804f5b3c2af9/railties/lib/rails/engine.rb:473:in `each'
/home/hdthinh/.rvm/gems/ruby-2.3.0/bundler/gems/rails-804f5b3c2af9/railties/lib/rails/engine.rb:473:in `eager_load!'
/home/hdthinh/.rvm/gems/ruby-2.3.0/gems/sneakers-2.3.5/lib/sneakers/tasks.rb:13:in `block (2 levels) in &lt;top (required)&gt;'
/home/hdthinh/.rvm/gems/ruby-2.3.0/gems/rake-11.2.2/exe/rake:27:in `&lt;top (required)&gt;'
/home/hdthinh/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
/home/hdthinh/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `&lt;main&gt;'
</code></pre>

<p>My codes are below</p>

<pre><code># Rakefile
require_relative 'config/application'
require 'sneakers/tasks'

Rails.application.load_tasks


# config/initializers/sneakers.rb
Sneakers.configure({})
Sneakers.logger.level = Logger::INFO

# app/workers/mailer_worker.rb
require 'sneakers'
class MailerWorker
  include Sneakers::Worker

  from_queue "test.user.login", env: nil

  def work(raw_post)
    p "you are successful in this queue! #{raw_post.to_s}"
    ack! # we need to let queue know that message was received
  end
end
</code></pre>

<p>My RabbitMQ also have the message at exchange "test.user.login"</p>

<p>I followed this article but errors occurred
<a href="https://stackoverflow.com/questions/36080524/rails-how-to-listen-to-pull-from-service-or-queue">Rails: How to listen to / pull from service or queue?</a></p>

<p>How can i run the sneakers without errors</p>

<p>Thanks</p>