I'm trying to implement Sneakers, but I'm having some issues. Below you can find the code which subscribers to my queue and the actual error.
require 'sneakers'
require 'jwt'
require 'redis'
require 'json'
$redis = Redis.new(url: ENV['REDIS_URL'], password: ENV['REDIS_PASSWORD'])
class Processor
include Sneakers::Worker
QUEUE_NAME = :my_queue
from_queue QUEUE_NAME
def work(msg)
message = JSON.parse(msg)
if message["type"] == "error"
$redis.incr "processor:#{err["error"]}"
end
controller = Object.const_get message['controller']
action = message['method']
controller.public_send(action, message['msg'])
ack!
end
end
Error:
[Exception error="uninitialized constant V1" error_class=NameError worker_class=Processor
The msg object
{\"controller\":\"V1::x::yController\",\"method\":\"my_method"\}
Any help is welcome, thank you!
Update
Even getting a simple Model such as my User
is resulting into the same error.
[Exception error="uninitialized constant User"
I'm running the sneakers worker like so:
sneakers work UserCreate --require app/workers/user_create.rb