I have a message is created from a post request through an HTTP gateway. What I'd really like is a way for any exception to be caught from any action in the ESB and be able to log it to a database. I saw some i开发者_开发问答nformation on setting the fault to in the message header but I cannot find a way to set it when the message is coming from an http gateway. Also I'm not sure the fault to is the best way of doing this, since some actions create other messages which in turn would also have to have a fault to set for them.
One solution could be to use the global action pipeline interceptor feature available since JBoss ESB 4.11 which allows you to configure a global interceptor for all services and intercept the flow on service instantiation, service start, service end, and service failure.
It is described here: https://issues.jboss.org/browse/JBESB-3724
Basically you implement the interface "org.jboss.soa.esb.listeners.message.PipelineInterceptor" and configure the interception point in "jbossesb-properties.xml".
<properties name="interceptors">
<property name="org.jboss.soa.esb.pipeline.failure.interceptors"
value="org.foo.DatabaseLoggingInterceptor"/>
</properties>
You can configure several different interceptors separated by a comma.
精彩评论