Skip to content

Selectively choose what message types should be sent to the Audit queue

License

Notifications You must be signed in to change notification settings

NServiceBusExtensions/NServiceBus.AuditFilter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NServiceBus.AuditFilter

Build status NuGet Status

Add message auditing filtering functionality to NServiceBus.

See Milestones for release notes.

Already a Patron? skip past this section

Community backed

It is expected that all developers either become a Patron to use NServiceBusExtensions. Go to licensing FAQ

Sponsors

Support this project by becoming a Sponsor. The company avatar will show up here with a website link. The avatar will also be added to all GitHub repositories under the NServiceBusExtensions organization.

Patrons

Thanks to all the backing developers. Support this project by becoming a patron.

NuGet package

https://nuget.org/packages/NServiceBus.AuditFilter/

Usage

Decorate messages with attributes

[IncludeInAudit]
public class MessageToIncludeAudit :
    IMessage;

snippet source | anchor

[IncludeInAudit]
public class MessageToIncludeAudit :
    IMessage;

snippet source | anchor

[ExcludeFromAudit]
public class MessageToExcludeFromAudit :
    IMessage;

snippet source | anchor

[ExcludeFromAudit]
public class MessageToExcludeFromAudit :
    IMessage;

snippet source | anchor

Add to EndpointConfiguration

With include by default

configuration.FilterAuditQueue(FilterResult.IncludeInAudit);

snippet source | anchor

With exclude by default

configuration.FilterAuditQueue(FilterResult.ExcludeFromAudit);

snippet source | anchor

Delegate filter fallback

The fallback/default value can also be controlled by a delegate.

configuration.FilterAuditQueue(
    filter: (instance, _) =>
    {
        if (instance is MyMessage)
        {
            return FilterResult.ExcludeFromAudit;
        }

        return FilterResult.IncludeInAudit;
    });

snippet source | anchor

Include/Exclude logic flow

Sample

The sample uses the Learning Transport and the resultant messages can be viewed in the Storage Directory.

Decorate messages with attributes

[ExcludeFromAudit]
public class MessageToExcludeFromAudit :
    IMessage;

snippet source | anchor

[ExcludeFromAudit]
public class MessageToExcludeFromAudit :
    IMessage;

snippet source | anchor

[IncludeInAudit]
public class MessageToIncludeAudit :
    IMessage;

snippet source | anchor

[IncludeInAudit]
public class MessageToIncludeAudit :
    IMessage;

snippet source | anchor

Add to EndpointConfiguration

endpointConfiguration.AuditProcessedMessagesTo("audit");
endpointConfiguration.FilterAuditQueue(
    defaultFilter: FilterResult.IncludeInAudit);

snippet source | anchor

Icon

Audit designed by Delwar Hossain from The Noun Project.

About

Selectively choose what message types should be sent to the Audit queue

Resources

License

Security policy

Stars

Watchers

Forks

Languages