I'm very new to eventmachine and I haven't been able to find an answer to this question online.
Right now I've been using em-mongo with eventmachine, and I've written essentially a poor man's mapper between documents and their respective objects. I just wanted to confirm that mongoid and mongomapper can not be used in an eventmachine environment because they are blocking and thus defeat the point of using eventmachine in the first place, and that I'm not wasting my time writing these mappers. :P
EventMachine Synchrony might be what you want:
https://github.com/igrigorik/em-synchrony
It supports Mongoid and I guess makes it thread safe. Haven't personally tried it but it looks promising with active development.
From a quick peek at the mongoid and mongo_mapper source code, you would be correct. My approach would be to just clone mongoid (or mongomapper) and swap out the blocking http connections with async connections. The majority of the framework details are not tied to the async http connection and should be re-usable. Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With