I have a RabbitMQ 3.4.2 instance with a web management plugin installed.
When I push to the message {'operationId': 194}
to the queue using Python's kombu queue package, the message is read on the other end as a dictionary.
However, when I send the message using the web console:
I get the following error on the receiving end:
operation_id = payload['operationId']
TypeError: string indices must be integers
I have tried adding a content-type
header and property, with no success.
Since the reader code is the same, it means that the web sender does not mark the sent message as a JSON / dictionary payload, and therefore it is read as a string on the other end.
Any idea how to mark a message as a JSON message using the RabbitMQ web console?
In this example a message containing sample sales data in JSON is received through an HTTP endpoint. This message is then converted to a string using a transformer and then sent to RabbitMQ using the AMQP connector. Once this message reaches the queue, it can be viewed throught he RabbitMQ web console.
Send JSON Data in POST Spring provides a straightforward way to send JSON data via POST requests. The built-in @RequestBody annotation can automatically deserialize the JSON data encapsulated in the request body into a particular model object.
I had to use content_type
instead of content-type
(an underscore instead of a hyphen).
This is a pretty questionable design decision, because the standard everybody knows is content-type
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With