Particular/NServiceBus — pull request #1611 by indualagarsamy (2013-10-02 22:41:42+00:00)
Title: Audit spike

Make Audit feature backwards compatible. If neither the AuditConfig section nor the registry settings for Audit are defined, instead of throwing an exception, audit feature will be turned off. Messages will continue to be forwarded if `ForwardReceivedMessagesTo` is set on the `UnicastBusConfig`.

If the registry value is set and the FRM is set, then 2 messages will be forwarded to the audit queue.
Here is the complete result of what happens when these configuration values are set:

**When Features.Audit is not explicitly turned off**

| RegistrySetting | AuditConfig, AuditQueue set to `Audit` | FRM in UnicastBusConfig set to `Audit` | Result |
| ------------- |:-------------:| :-----:|:-----|
| 0 | 0 | 0 | No messages forwarded anywhere |
| 0 | 0 | 1 | 1 Message forwarded to a queue named audit |
| 0 | 1 | 0 | 1 Message forwarded to a queue named audit |
| 0 | 1 | 1 | 2 Messages forwarded to a queue named audit |
| 1 | 0 | 0 | 1 Message forwarded to a queue named audit and a warning will be logged in debug mode that the audit values are configured in the registry and that user needs to run the powershell commandlet |
| 1 | 0 | 1 | 2 Messages forwarded to a queue named audit and a warning will be logged in debug mode that the audit values are configured in the registry and that user needs to run the powershell commandlet |
| 1 | 1 | 0 | 1 Message forwarded to a queue named audit |
| 1 | 1 | 1 | 2 Messages forwarded to a queue named audit |

**When Features.Audit is explicitly turned off via INeedInitialization**

| RegistrySetting | AuditConfig, AuditQueue set to `Audit` | FRM in UnicastBusConfig set to `Audit` | Result |
| ------------- |:-------------:| :-----:|:-----|
| 1 | 1 | 0 | No Message forwarded to the queue named audit |
| 1 | 1 | 1 | 1 Message forwarded to a queue named audit |

**TODO:**
1. The acceptance for Audit fail when the registry key is not set. Because when the acceptance test are being executed, the AuditConfig value read comes up as null and messages are not being forwarded. Need to fix whatever is causing the hiccup in the acceptance test.
2. When the host is installed via nuget, remove the AuditConfig to avoid 2 messages ending up in the audit q.