Note that there are some explanatory texts on larger screens.

plurals
  1. POMongoMapper, MongoDB and EventMachine
    primarykey
    data
    text
    <p>I am using DaemonKit to create an AMQP listener. Whenever a message comes across the wire, I would like to log it to MongoDB. I have moved my Rails MongoDB configs over and the connection works fine. When I try to create a new model, I get an error in the Model.create method.</p> <pre><code>IOError when attempting to close socket connected to localhost:27017: #&lt;IOError: closed stream&gt; /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/mongo-1.3.1/lib/mongo/connection.rb:856:in `rescue in send_message_on_socket': Operation failed with the following exception: closed stream (Mongo::ConnectionFailure) from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/mongo-1.3.1/lib/mongo/connection.rb:843:in `send_message_on_socket' from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/mongo-1.3.1/lib/mongo/connection.rb:483:in `block in receive_message' from &lt;internal:prelude&gt;:10:in `synchronize' from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/mongo-1.3.1/lib/mongo/connection.rb:482:in `receive_message' from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/mongo-1.3.1/lib/mongo/cursor.rb:407:in `block in send_initial_query' from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/mongo-1.3.1/lib/mongo/connection.rb:609:in `instrument' from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/mongo-1.3.1/lib/mongo/cursor.rb:406:in `send_initial_query' from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/mongo-1.3.1/lib/mongo/cursor.rb:371:in `refresh' from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/mongo-1.3.1/lib/mongo/cursor.rb:87:in `next_document' from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/mongo-1.3.1/lib/mongo/cursor.rb:248:in `each' from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/mongo-1.3.1/lib/mongo/cursor.rb:267:in `to_a' from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/mongo-1.3.1/lib/mongo/cursor.rb:267:in `to_a' from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/plucky-0.3.8/lib/plucky/query.rb:76:in `all' from /Volumes/External/Projects/ruby/alertsdaemons/eventmachine/libexec/eventmachine-daemon.rb:17:in `block in &lt;top (required)&gt;' from /Volumes/External/Projects/ruby/alertsdaemons/eventmachine/libexec/eventmachine-daemon.rb:15:in `loop' from /Volumes/External/Projects/ruby/alertsdaemons/eventmachine/libexec/eventmachine-daemon.rb:15:in `&lt;top (required)&gt;' from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require' from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `block in require' from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in `block in load_dependency' from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:596:in `new_constants_in' from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in `load_dependency' from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require' from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/daemon-kit-0.1.8.2/lib/daemon_kit/application.rb:38:in `run' from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/daemon-kit-0.1.8.2/lib/daemon_kit/application.rb:21:in `exec' from /Volumes/External/Projects/ruby/alertsdaemons/eventmachine/bin/eventmachine:12:in `&lt;top (required)&gt;' from -e:1:in `load' from -e:1:in `&lt;main&gt;' </code></pre> <p>code for creating the object:</p> <pre><code># Sample loop to show process loop do DaemonKit.logger.info "I'm running" message = Message.create({ :first_name =&gt; 'Lee', :last_name =&gt; 'Faus' }) puts message.inspect puts message.count sleep 5 end </code></pre> <p>I had read that I could fork mongomapper to make the http calls async, but these errors seem to be coming from the mongodb ruby driver. any help is greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload