开发者

Evaluating XPath expressions in JBoss Drools

I am working within a enterprise architecture that is processing a large amount of XML messages. We have recently been given the requirement to perform some calculations on data contained in those XML messages and add some results to the message header before passing the message out of the enterprise to an external consumer. Our architecture is based on the JBoss SOA-P and I am currently evaluating JBoss Drools 5.2.0 for performing these message operations.

I know that I can simply hydrate a POJO from the XML, execute the rules on it, and add the appropriate result. If possible, however, I would like to remove compile-time dependencies on the XML message structure due to dynamic requirements around the schema as well as significant hurdles in deploying new compiled code to our production environment (read: red tape). I would ideally like to use XPath evaluations on the raw XML in the .drl rules. Some searching turned up the SXC project, which appears to be exactly what I need, but there is very little information on how to use it and it seems to be dormant since 2007. Additionally, it has been compiled against Drools 4.0.4 and I am required to use 5.2.0.

Does anyone know of a good way to evaluate XPath expressions against XML in Drools rules? Alternatives to XPath that allow XML structure changes to be compensated for in Drools r开发者_开发技巧ules at runtime are also welcome.

Thanks!


we had an expert on Drools visiting our company and taking about Drools short time ago. I am developing a Service with a lot of rules that are constantly changing and we thought about using Drools.

The expert told us to use Proxy-Objects to wrap the data we needed for Drools. You could try to use a Proxy-Object in which you put the XML along with some methods. When Drools is trying to evaluate the Proxy-Object it is infact evaluating your XML. This is a littlebit dirty - comparing to Drools specifications - since the Object would not hold the data when entered into the Working-Memory of Drools, but rather extract the data when asked.

I am no expert in Drools, but the only alternative I see, is to "hydrate a POJO" as you mentioned before, which would be best according to Drools specifications.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜