why large messages produced and published to rabbitmq by bunny in ruby are encoded into base64

898 views Asked by At

I'm using bunny gem to publish messages, which are json string, to the rabbitmq server. The code are as followed:

def send_rabbitmq value
    conn = Bunny.new(:host => "xxx.xxx.xxx.xxx", :vhost => "/", :user => "abc", :password =>"123")
    conn.start

    ch = conn.create_channel
    ch.basic_publish( value ,"exchange.x", "routing.key", :payload_encoding => "string")
    sleep 1.0
end

However, what I get from the rabbitmq server are just messy string which are encoded by base64. The message (value in the code) I publish is bigger than 90000 size. I figure it out by copying all the string into a encoding tool and decode the messy string by base64, which are just the data I sent, but only a part of them. It looks like the data published is truncated, with the absence of bracket, comma or some key/values.

So, here is my question, I know it's not suggested to publish huge message to rabbitmq, but how come the data is encoded into base64 and why they are truncated.

Any ideas? Thx.

0

There are 0 answers