Message auditing - rebus-org/Rebus GitHub Wiki
Rebus can be configured to perform "message auditing", which is the process of taking a copy of all messages. This may sound like a daunting task, but it isn't, because messages can only "disappear" in two places:
- When they have been properly handled
- When they have been published and there were 0 subscribers
In general, a publisher does not know the number of subscribers (because the transport might implement multicast natively), so the safe way of auditing messages is to send a copy of
- each properly handled transport message with the
rbs2-audit-reason
header set tohandled
- each published transport message with the
rbs2-audit-reason
header set topublished
to the configured audit queue. A few additional headers with audit information will be added to the message copy.
How to configure it?
In order to enable message auditing, use the Rebus configuration API like this:
Configure.With(adapter)
.Transport(t => t.UseMsmq("server.input"))
.(...)
.Options(b => b.EnableMessageAuditing("audit@cpvm010"))
.(...)
in order to send audited messages to the audit
queue on the machine cpvm010
(assuming MSMQ here).