data types of headersI am trying to send a message directly to Exchange using the REST endpoint:
/api/exchanges/vhost/name/publish
The sample payload I am using is:
{
"properties": {
"timestamp": 1536959503,
"message_id": "100",
"correlation_id": " ",
"priority": 0,
"delivery_mode": 2,
"headers": {
"counter": 0,
"content-type": "application/xml",
"correlation-id": " ",
"message-id": 100,
"message-type": "message1",
"status": "P"
},
"content_type": "application/xml"
},
"routing_key": "p.ee.pp.rr",
"payload": "sample",
"payload_encoding": "string"
}
In this, the only numerical values in the headers are message-id
and counter
.
When I receive the message from the queue into a headers map of type <String, Object>
, the data type for the numerical values is Long
.
My code casts message-id
to long
and counter
to Integer
. I get a class cast exception when doing the latter.
I am interested in knowing:
Who is assigning the data type to the numerical values as
Long
? At which stage does it get assigned (in the flow of REST endpoint to the Queue)is
Long
the default type when reading data from JSON?