How get username from :headers in AMQPClient with using RabbitMQ?

All or @tanmaykm I’m using AMQPClient and I would like get user name from message.
When I run commands

gChannel = channel(conn, AMQPClient.UNUSED_CHANNEL, true)
msg = basic_get(gChannel, “rQueue”, false)

I get

Message(UInt8[0x7b, 0x22, 0x64, 0x61, 0x74, 0x61, 0x22, 0x3a, 0x5b, 0x7b … 0x73, 0x22, 0x3a, 0x33, 0x36, 0x30, 0x30, 0x7d, 0x7d, 0x7d], Dict{Symbol,Union{TAMQPBit, TAMQPFieldTable, TAMQPLongStr, TAMQPShortStr, Integer}}(:headers=>FieldTable
username =>,:content_type=>application/json,:correlation_id=>9f890e3e-3586-434e-99e6-1adbf9729e8f,:priority=>0x00,:delivery_mode=>0x02,:content_encoding=>UTF-8), 1684, “”, 1, true, “yop”, “add_rQueue”, 1)

I would like get user name probably from FieldTable but If I run get method return me answer:

julia> gHeaders = get(, :headers, “”)

How can I get username from this message?

I think you want to call headers(msg) to get the Dict of headers for your rabbit message. Unless your data is in the message data, then you want to access, but that just returns a byte array (Vector{UInt8}). For me, my rabbit message data is JSON, so I do in order to parse the message data into something I can use.

@quinnj or @tanmaykm yes exactly, I would like get values of headers e.g. username. Type of :headers is AMQPClient.TAMQPFieldTable.
I got

julia> gHeaders
    username =>

juliia> gHeaders

I would like log username as string and used it in Message for response queue. Now I don’t know how? (I noticed detail that after the second call to the FieldTable, the FieldTable of gHeaders is empty :frowning: .)
My data in the message data is fine. For me, my message data is JSON, too. I use JSON.parse(String( together with JSONSchema.isvalid.

Finally, the simple copy function helped me.

global gHeaders = get(, :headers, “”)
logMsg("username: " * String(copy([1]