简体   繁体   中英

Read message body (raw xml) from MSMQ using Nservice bus before Handle() is called

Is There any way I can read raw xml message from MSMQ using NService bus before it parses it to corresponding class object. I am getting message in Handle(Class obj). This is working fine but I want to log the xml from raw message body which NService parses to class object .

Have a look at transport message mutators . You'll be able to inspect both the Body and Headers of the message

@Chris-Bednarski's answer is correct, but I wanted to add that NServiceBus has auditing built-in which takes the complete messages and passes it on to another queue, so you don't have to do that yourself.

As of version 4, there is another process which feeds off of that queue and persists those messages into RavenDB as well as a UI (called ServiceInsight) that enables you to see everything that flowed through your system. You can find it here:

http://particular.net/ServiceInsight

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM