Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eventmachine not initialized in thin #21

Closed
mixtli opened this issue Aug 29, 2010 · 5 comments
Closed

eventmachine not initialized in thin #21

mixtli opened this issue Aug 29, 2010 · 5 comments

Comments

@mixtli
Copy link

mixtli commented Aug 29, 2010

I'm on rails 3.0rc2 and ruby 1.9.2. When I add:
AMQP.connect(:host => "localhost", :user => "guest", :pass => "guest", :vhost => "/")

to an initializer and run thin start, I get:
eventmachine.rb:714:in `connect_server': eventmachine not initialized: evma_connect_to_server (RuntimeError)

It's my understanding that thin should already be running a reactor. Am I doing something wrong?

Thanks!

@tmm1
Copy link
Owner

tmm1 commented Aug 29, 2010

Thin is probably started later, once rails boots up.

You can use EM.next_tick so the connect happens on the first tick of the reactor when it is started.

EM.next_tick{ AMQP.connect(...) }

@skrat
Copy link

skrat commented Nov 16, 2010

This solved the issue for me, maybe it should be in the README

@botanicus
Copy link
Collaborator

I added the note to the README: 1a99333

@kulpreet
Copy link

kulpreet commented Mar 8, 2011

Thanks for a great gem.

Had to do gem 'amqp', :require => 'mq' in Gemfile as per http://groups.google.com/group/ruby-amqp/browse_thread/thread/408564eb31f44f17

Might be handy to also include in the README when you talk about using the next_tick.

Thanks again

@botanicus
Copy link
Collaborator

Hi, please do not use this repository anymore, the new official one is at http://github.com/ruby-amqp/amqp BTW we are just changing the API, so you shan't need require: "mq" anymore, see https://github.com/ruby-amqp/amqp/blob/master/lib/amqp.rb It'll be part of the upcoming 0.8 release.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants