NServiceBus: human readable message bodies

1.3k Views Asked by At

I have started learning about NServiceBus to determine whether we can use NServiceBus the way we want. When I configured NServiceBus to use the JsonSerializer for serialization, I expected to be able to read the contents of the messages directly in the queue. But instead of being JSON formatted text, the body is hexadecmial. We would like to be able to open up a queue/table and view the contents of the messages without needing to convert every message from hex to text. Is this possible?

PS.: I am using NServiceBus v 5.2.14 and NServiceBus.Host v 6.0.0

1

There are 1 best solutions below

3
On

There are several options:

MSMQ

For MSMQ I honestly believe the best option would be to use ServiceInsight. It gives you much more than just viewing the message payload but if you're in a position that you need to know why your system is behaving the way it is, this is the best option.

Regarding native tools for MQMS there are several options http://docs.particular.net/nservicebus/msmq/viewing-message-content-in-msmq

SQL Server Transport

While ServiceInsight works across all the transports, if you are using the SQL Transport and you just want to see content of your messages you can run a simple SQL query query:

SELECT CONVERT(VARCHAR(max), [Body]) FROM [YourQueue]

Having said that, you are technically converting message to text through this query.