17.2. Enable Custom Auditors


Audit mechanism requires CDI runtime environment to run.
To enable custom auditors, define the Auditor implementations with the @Named annotation. It helps Apache Camel component to recognize all the auditor implementations. Camel Exchange Bus, a default implementation used by SwitchYard, look up for bean definitions with @Audit annotation.

@Audit
@Named("custom auditor")
public class SimpleAuditor implements Auditor
{
@Override
public void beforeCall(Processors processor, Exchange exchange)
{
System.out.println("Before " + processor.name());
}
 
@Override
public void afterCall(Processors processor, Exchange exchange) 
{
System.out.println("After " + processor.name());
}
 
}

Note
Do not include any state inside the Custom Auditor's field. Red Hat recommends you to use exchange properties or message headers to store values.
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.