Skip to end of metadata
Go to start of metadata
Unknown macro: {node}

This feature is available only with CamelExchangeBus

As noticed in Auditing Exchanges page the auditing feature is built on top of Camel mediations. Camel let developers introduce own InterceptStrategy for given mediation in more declarative way. From SwitchYard developer point of view Camel's InterceptStrategy is a low level API. This point allows to customize mediation steps done by SwitchYard. You will be able to replace corresponding logic with your own implementations.

Camel InterceptStrategy

Camel supports intercept as a part of DSL which is translated to some chain of Camel exchange processors. In case of Camel Exchange Bus it's not possible to have extend route builder thus only one way is usage of InterceptStrategy directly. The InterceptStrategy interface have only one method wrapProcessorInInterceptors. This method is called during creation of the route and allows to wrap processor or replace it. If you will return new processor from this method then Camel will use it instead of target processor passed to method invocation.

Writing custom InterceptStrategy

Custom InterceptStrategy can be linked with created CamelContext instance with CDI annotations. Two requirements must be passed - first of all - you must implement InterceptStrategy, second you have to give a name for your bean instance. Example below shows simplest intercept strategy which actually does nothing.

Custom logic inside InterceptStrategy

Intercept strategy instance have access to the route model. The wrapProcessor method is called only once per created route. The runtime data comes to Processor instance which is executed once per sent exchange. Example below shows simplest implementation of time couter

Given processor uses a helper class from Camel API called DelegateAsyncProcessor which allows to not block threads with synchronous calls.

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.