Book Image

Learning NServiceBus - Second Edition

By : David Boike
Book Image

Learning NServiceBus - Second Edition

By: David Boike

Overview of this book

Table of Contents (18 chapters)
Learning NServiceBus Second Edition
About the Author
About the Reviewers

Auditing messages

At times, it can be difficult to debug a distributed system. Commands and events are sent all around, but after they are processed, they go away. We may be able to tell what will happen to a system in the future by examining queued messages, but how can we analyze what happened in the past?

For this reason, NServiceBus contains an auditing function that will enable an endpoint to send a copy of every message it successfully processes to a secondary location, a queue that is generally hosted on a separate server.

This is accomplished by adding an attribute or two to the UnicastBusConfig section of an endpoint's configuration:

<UnicastBusConfig ForwardReceivedMessagesTo="audit@SecondaryServer"TimeToBeReceivedOnForwardedMessages="1.00:00:00">
   <!-- Mappings go here -->

In this example, the endpoint will forward a copy of all successfully processed messages to a queue named...