How to create a custom worker for trinidad_worker_extension?

8 views
Skip to first unread message

Johan Wasserman

unread,
Apr 12, 2015, 2:56:30 AM4/12/15
to rails-t...@googlegroups.com
Hi all,
I'm trying to understand how to write a custom worker for the trinidad_worker_extension.  I am very much a noob with ruby and rails and cannot find any good documentation online that describes the basics of workers, let alone how to get one running with trinidad's worker extension.

What I'm hoping to achieve is start a permanently running worker (for the life of trinidad process is running my rails app), the worker should constantly monitor a RabbitMQ queue using:
  q.subscribe(:block => true) do |delivery_info, properties, body|
    #do something with body
  end

I'm not even sure if a worker is the correct way to go.  I'm just looking for anything that will start up in parallel with my rails app when I run trinidad, and monitor the queue (in a separate thread).

Any advise on how to create a custom worker and get it running under trinidad, or any other way of achieving running a job in a separate thread under trinidad?

Rails 4.2.0
JRuby 1.7.19
Trinidad 1.4.6 (Tomcat 7.0.50)

ps: I'm not sure I want to run this very small requirement under the solutions available out there (Sidekiq, Sneakers, etc), I had a go at frenzy_bunnies but wasn't able to start it in parallel with my rails app by running trinidad (in my apps root), maybe again to a lack of knowledge.  This stuff isn't really well documented out there and all documents seem to presume that the reader already knows what they are doing.

Thanks and kind regards,
Johan.


Reply all
Reply to author
Forward
0 new messages