Hi everyone,
Just thought I’d make a post here to let people know I made a little Solace utility, and it’s now public on GitHub:
Often times when developing/debugging a Solace app, I just want to dump / echo messages that are going over the broker so I can see them. For this, SdkPerf with -md
“message dump” flag is exceptionally useful. But when it prints a message, it shows the payload as both hex and ASCII values formatted into columns;
^^^^^^^^^^^^^^^^^^ Start Message ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Destination: Topic 'pq-demo/stats/sub/pq-demo/sub/sub-18490'
Priority: 4
Class Of Service: COS_1
DeliveryMode: DIRECT
Binary Attachment: len=126
1d 00 7e 7b 22 72 65 64 22 3a 30 2c 22 6f 6f 73 ..~{"red":0,"oos
22 3a 30 2c 22 71 75 65 75 65 4e 61 6d 65 22 3a ":0,"queueName":
22 70 71 31 32 22 2c 22 73 6c 6f 77 22 3a 30 2c "pq12","slow":0,
22 72 61 74 65 22 3a 30 2c 22 6e 65 77 4b 73 22 "rate":0,"newKs"
3a 30 2c 22 64 75 70 65 73 22 3a 30 2c 22 6b 65 :0,"dupes":0,"ke
79 73 22 3a 34 2c 22 61 63 6b 64 22 3a 30 2c 22 ys":4,"ackd":0,"
67 61 70 73 22 3a 30 2c 22 66 6c 6f 77 22 3a 22 gaps":0,"flow":"
46 4c 4f 57 5f 41 43 54 49 56 45 22 7d 00 FLOW_ACTIVE"}.
This is great for binary messages or messages of any type, but often I’m working with either JSON or XML payloads. So I took one of our basic Solace JCSMP samples and added the ability to pretty-print payloads if it recognizes them as either JSON or XML:
^^^^^^^^^^^^^^^^^^ Start Message ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Destination: Topic 'pq-demo/stats/sub/pq-demo/sub/sub-18455'
Priority: 4
Class Of Service: USER_COS_1
DeliveryMode: DIRECT
Message Id: 6
Binary Attachment: len=126
JSON TextMessage: {
"red": 0,
"oos": 0,
"queueName": "pq12",
"slow": 0,
"rate": 1,
"newKs": 0,
"dupes": 0,
"keys": 4,
"ackd": 0,
"gaps": 0,
"flow": "FLOW_ACTIVE"
}
^^^^^^^^^^^^^^^^^^ End Message ^^^^^^^^^^^^^^^^^^^^^^^^^^^
It works with either Direct topic subscriptions (comma separated list if more than one) (also remember to use " quotes if using >
wildcard), or it can bind/consume from a single queue, as well as browse a queue to ensure messages aren’t consumed.
Give it a try! Let me know if you have any issues. ??
https://github.com/SolaceLabs/pretty-dump
Aaron