🎄 Happy Holidays! 🥳
Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.
Happy Holidays!
Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.
SdkPerf, but Pretty for JSON and XML!
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
Comments
-
Bump to this thread! Have updated my Pretty Dump utility to work with:
- JSON objects, arrays, and XML
- Non-UTF-8 chars
- Direct topic subscriptions (multiple if desired), consuming from a queue, or browsing a queue
Give it a try and let me know if you like it: https://github.com/SolaceLabs/pretty-dump
1 -
Wow, it's been more than a year since I updated this thread! ⏳
PrettyDump v1.1 has just been released 🎉 and includes MANY updates/features since this previous post. This tool is invaluable for any developer working with Solace, or any admin looking to browse their queues effectively. A quick summary:
- Listen/dump any message going across your Solace broker (Direct subs, queue consume, browse)
- ANSI colour support (6 different colour schemes)
- JSON, XML, Protobuf, and binary pretty-print formatting
- Multiple "indent" payload display options (e.g. one-line mode, hide payload, topic only, etc.)
- Temporary queue consumer, with topic subscriptions (can use
!
NOT subscriptions as well) - Broker-side Selector support for queues, and client-side payload content-filtering for easy searching of messages
count
parameter that allows either: stopping after n messages, or gathering/storing last n messages and dumping them when program terminates- Timestamp of received messages
- Supports automatic payload ungzipping and deflating
- Support for SMF WebSockets
- And lots, lots more
Available as a Java app (JRE 8 required) or a self-contained Docker container. Check out the README for more information: https://github.com/SolaceLabs/solace-pretty-dump
Quite a few customers who have complained about performance issues with JMSToolBox (large payloads, deep queues, etc.) have been very satisfied with the capabilities of PrettyDump. So give it a try! 👍🏼
2