← Back to team overview

txamqp-user team mailing list archive

Re: pickling objects through amqp

 

On Wed, Sep 2, 2009 at 1:01 PM, Fabrizio Mancini<mr.file@xxxxxxxxx> wrote:
> hi everybody,
> i'm prototyping an app that should use txamqp and rabbitmq.
> I need to send python objects through the queues via txamqp.
> I was thinking about using pickle to serialize objects, but doesn't
> seems to function.
> I've downloaded two example files from esteve fernandez that are
> called txamqp_consumer.py and txamqp_publisher.py.
> I've modified only these lines:
>
> txamqp_consumer.py
> def recv_callback(msg, chan, queue):
>    print 'Received: ' + msg.content.body + ' from channel #' + str(chan.id)
>    return (queue.get().addCallback(recv_callback, chan, queue))
>
> in
>
> def recv_callback(msg, chan, queue):
>    msgbody = pickle.dumps(msg.content.body)
>    print 'Received: ' + msgbody + ' from channel #' + str(chan.id)
>    return (queue.get().addCallback(recv_callback, chan, queue))
>
> txamqp_publisher.py
> msg = Content(body)
>
> in
>
> msg = Content(pickle.loads({'a':123,'b':456}))

Could you post all the code on pastie or equivalent ?

Antonin



Follow ups

References