You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem of the replace is that you need to reimplement the existing auditing behavior by copy pasting the code. It would be awesome if the pipeline allows to decorate existing behaviors without knowing the concrete class of the core behavior. This could for example be achieved with the follwowing syntactic sugar:
class FilteringAuditBehavior : IBehavior<IncomingContext>
{
public void Invoke(IncomingContext context, Action next)
{
var auditBehavior = context.Get<IBehavior<IncomingContext>>(WellKnownSteps.AuditBehavior);
var auditResult = new AuditFilterResult();
context.Set(auditResult);
next();
//note: and rule operating on the raw TransportMessage can be applied here if needed.
// Access to the message is through: context.PhysicalMessage. Eg: context.PhysicalMessage.Headers.ContainsKey("NServiceBus.ControlMessage")
if (auditResult.DoNotAuditMessage)
{
return;
}
auditBehavior.Invoke(context, next);
}
//here we inject our behavior
class AuditFilteringOverride : INeedInitialization
{
public void Customize(BusConfiguration configuration)
{
configuration.Pipeline.Replace(WellKnownStep.AuditProcessedMessage, typeof(FilteringAuditBehavior), "A new audit forwarder that has filtering");
}
}
}
The classes can be left internal but it allows the user to decorate existing behaviors. Thoughts?
The text was updated successfully, but these errors were encountered:
Let's consider this example:
https://github.com/Particular/NServiceBus/blob/develop/src/NServiceBus.AcceptanceTests/PipelineExt/FilteringWhatGetsAudited.cs
The problem of the replace is that you need to reimplement the existing auditing behavior by copy pasting the code. It would be awesome if the pipeline allows to decorate existing behaviors without knowing the concrete class of the core behavior. This could for example be achieved with the follwowing syntactic sugar:
The classes can be left internal but it allows the user to decorate existing behaviors. Thoughts?
The text was updated successfully, but these errors were encountered: