Ruby on Rails Friday, August 7, 2015

Hello,

I use RabbitMQ to transfer information from one component to another within my system. I have written a rake task which sets up the RabbitMQ client (the Bunny gem), then sets up a blocking listener so that I can process incoming messages.  When I run this rake task, I use the :environment task to load the rails app (the rake task relies on several models and service objects). 

When I deployed my system to production, I noticed that my Rabbit task was not working as expected. Digging into the log, I found that the service objects and models were not being loaded by rake. This was strange, since I called :environment.  Looking further into it, I've been informed that this is the expected behavior, that rake does not preload the rails environment in production.

I'm guessing I'm doing something wrong. Should I not be using rake to set up these listeners? If rake is acceptable, is there a way to test the load path so I see these errors before production?  Is :environment only designed to be used in development?

Thanks,
Tyler

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a1c653f0-6fdc-4d05-8869-ded21dd75a4b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment