Solutions    |    Downloads    |    License    |    Documentation    |    Training    |    Support    |    Customers    |    About Us

Auditing With NServiceBus

Last Updated: Nov 27, 2012 05:30PM IST
Auditing

The scalability inherent in parallel message-driven systems
makes them more difficult to debug than their sequential,
synchronous and centralized counterparts.

For these reasons, NServiceBus provides message auditing
built-in to every endpoint. All you need to do is tell
NServiceBus where you want to send those messages.

Configuring Auditing

In order to turn on auditing, all you have to do is to add the attribute "ForwardReceivedMessagesTo" to the UnicastBusConfig section of an endpoint's configuration file as shown below:

<!-- You can control the TimeToBeREceived on messages going to the audit queue  -->
<!-- by using the TimeToBeReceivedOnForwardedMessages setting -->
<UnicastBusConfig ForwardReceivedMessagesTo="AuditQueue@AdminMachine" >
  <MessageEndpointMappings>
    <!-- rest of your configuration here -->
  </MessageEndpointMappings>
</UnicastBusConfig>

 

The above configuration will cause all messages arriving at the given endpoint to be forwarded to the queue called "AuditQueue" on the machine called "AdminMachine". You can specify any queue on any machine, though only one is supported. Of course, you can forward on from that machines as well.

What you choose to do with those messages is now up to you - you can save them in a database, do some custom logging, anything.

The important thing is that you now have a centralized record of everything that's happening in your system while maintaining all the benefits of keep things distributed.

Message headers

On each message there are some custom headers attached that you can look at using a 3rd party tool for MSMQ.

Key Description
NServiceBus.Version Version of NServiceBus
NServiceBus.TimeSent When was the message sent
NServiceBus.EnclosedMessageTypes Massage type(s) within the envelope
NServiceBus.ProcessingStarted Time when processing of the message started
NServiceBus.ProcessingEnded Time when the processing was finished
NServiceBus.OriginatingAddress From where did the envelope originate

 

Next Steps

Learn more about how logging works in NServiceBus.

About NServiceBus    |    Contact Us    |    Privacy    |    Follow us on:   
Copyright 2010-2013 NServiceBus. All rights reserved
support@nservicebus.com
http://assets1.desk.com/raca8b478c9bd89640c451013350d59caa6b66ee1/javascripts/
nservicebus
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
true
Invalid characters found
/customer/en/portal/articles/autocomplete
There was an error contacting Get Satisfaction
View All
0
discussions
replies
Questions
Ideas
Problems
Praise