Option to Dump RabbitMQ Headers and/or Other Properties
sshaw opened this issue · 4 comments
In this case I reckon it'd be better to dump the payload to a YAML file with two documents, one with the properties, one with the payload:
---
{
"priority": 0,
"timestamp": 1455915599,
"headers": {
"foo": "bar"
}
---
{
"a": 123,
"b": 456
}
Thoughts?
@sshaw I like the idea of dumping (optionally?) the message headers. What do you mean by "other properties"?
However, I don't think the choice for YAML here is the right one, because:
- The message body may be binary.
- As in your example, you already mix two serialization formats: JSON and YAML.
I suggest instead that this new optional mode will save the headers in a JSON file next to each saved message payload; so the program will produce:
/tmp/msg-0000 # That's the payload, possibly binary
/tmp/msg-0000-amqp-headers.json # Message 0's headers serialized as JSON
/tmp/msg-0001
/tmp/msg-0001-amqp-headers.json
...
What do you think?
@sshaw I like the idea of dumping (optionally?) the message headers. What do you mean by "other properties"?
I just meant the AMQP message attributes, or properties, or whatever the official name is.
I suggest instead that this new optional mode will save the headers in a JSON file next to each saved message payload; so the program will produce:
That makes sense, but I would use whatever the AMQP specs uses in the filename instead of "headers" (though maybe they do use "headers" 😄).
Scanning the AMQP docs it seems that message properties is the right term. So:
/tmp/msg-0000
/tmp/msg-0000-properties.json
/tmp/msg-0001
/tmp/msg-0001-properties.json
...
@sshaw do you want to try and craft this into a pull request?
@sshaw do you want to try and craft this into a pull
Sure! I just (almost) finished my first Go program (though I'm not necessarily itching for more Go 😏). Give me a few days and I'll put something together...