Red Hat Training

A Red Hat training course is available for Red Hat Fuse

17.6. Determine Location for Audit Assignment

In SwitchYard, you may choose to provide an argument to the @Audit annotation. The accepted values for this comes from org.switchyard.bus.camel.processors.Processors enumeration. For example, the following combination can handle only validation occurrences:
@Audit(Processors.VALIDATION)
Note the following important facts about validation, transformation, and transaction in SwitchYard:
  • The validation is executed twice for in-only exchanges and four times for in-out exchanges.
  • The validation occurs before and after transformation of inbound messages.
  • When SwitchYard sends outgoing messages, the validation occurs before and after transformation of outbound messages.
  • Transformation is executed once for in-only exchanges and twice for in-out exchanges.
  • Transaction phase is always executed twice.
If you want to implement only one execution of your auditor, use the following combination:
@Audit(Processors.PROVIDER_CALLBACK).
Here, the auditor is executed just before sending exchange to service implementation. You can also implement one auditor instance with few mediation steps. For example, a bean with annotation following:
@Audit({Processors.PROVIDER_CALLBACK, Processors.CONSUMER_CALLBACK})
This bean is executed twice. One pair of before or after call for provider service and second pair for outgoing response.