2

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

jk1990
  • 341
  • 3
  • 12
  • Which transport are you using? MSMQ? – Udi Dahan May 03 '16 at 06:14
  • @UdiDahan: I am experimenting with both MSMQ and SQL Transport (different solutions that don't interact with eachother). However, the messages are stored as hex in both solutions. Ps.: just to clarify: the message is formatted correctly as JSON (hex to text converter displays the expected JSON) – jk1990 May 03 '16 at 10:14
  • 1
    What tool are you using to read the messages? – Sean Farmar May 03 '16 at 21:27
  • the built in (ie Computer Management) Windows Message Queuing viewer only shows message bodies as hex. Try using another tool. – Chris Bednarski May 04 '16 at 05:26
  • For MSMQ I am viewing the messages in Visual Studio's Server Explorer. For SQL Transport I am looking at the rows in the databse. – jk1990 May 04 '16 at 06:39

1 Answers1

3

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.

Simon
  • 33,714
  • 21
  • 133
  • 202
Hadi Eskandari
  • 25,575
  • 8
  • 51
  • 65
  • Thanks, I'll check out ServiceInsight :) – jk1990 May 04 '16 at 06:41
  • Another suggestion for MSMQ would be Queue Explorer, we use both and they both provide different kinds of benefits. Service Insight is great for visualising the message flow in your application, while Queue explorer is a massive upgrade over the baked in Windows MSMQ manager. – Yannick Meeus May 20 '16 at 08:32
  • @YannickMeeus Thanks, although it was already mentioned on the document page and the link is above – Hadi Eskandari May 20 '16 at 10:26