1

I implementing async process which handle documents from mongodb database. I have something like master thread which check if new objects exist in collection and then put it to the queue (RabbitMQ), and a several handlers (currently one) which handle messages from the queue. So when I put message to the queue I need to serialize it to binary format, because I'm working with amqp protocol. And when handle the message I need my object back from binary data. By the way I operate with rabbitmq via amqp gem

I try do the things with BSON gem, but it handle only hashes and throw exception then trying serialize object itself. trying msgpack-rails gem, but it throws 'undefined method .to_msgpack' error.

So please help me with fast to binary serialization, and from binary deserialization. Thanks.

silent_coder
  • 6,222
  • 14
  • 47
  • 91
  • are you saying that you want to pass around the whole instantiated object? why not just pass ids and have the receiver fetch the object themselves against mongoid ? – m_x Mar 21 '13 at 12:40
  • other than that, ruby's built-in binary serialization mechanism is called [Marshal](http://www.ruby-doc.org/core-1.9.3/Marshal.html) – m_x Mar 21 '13 at 12:43
  • passing will take additional call to database each time. Db is the most hard used part of my system so i'm trying to reduce db call to minimum. Talking about marshal - curenntly trying it. Thanks for your response. – silent_coder Mar 21 '13 at 12:54

0 Answers0