如何在 jersey rest web 服务中集成 drools

How to integrate drools in jersey rest web service(如何在 jersey rest web 服务中集成 drools)

本文介绍了如何在 jersey rest web 服务中集成 drools的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个 jersey est 网络服务 API.现在我想在这个休息服务中集成 DROOLS 规则.在其余服务中,在确定所有必需条件后,我想将其发送到 drools 规则引擎并触发规则.这个怎么做.请帮我一步一步指导.

I have developed a jersey est web service API. Now I would like to integrate DROOLS rules in this rest service. IN the rest service, after ascertaining all required conditions, i would like to send it to the drools rule engine and the fire the rule. How to do this. Please help me step by step guidance.

推荐答案

这不是 Jersey,但这里是一个 REST Web 服务的示例,它使用 Drools 评估请求:https://github.com/gratiartis/sctrcd-payment-validation-web

It's not Jersey, but here is an example of a REST web service, which evaluates requests using Drools: https://github.com/gratiartis/sctrcd-payment-validation-web

实际上,您创建了一个封装知识库的单例 bean.当验证请求到达时,您可以创建知识会话、插入事实并执行规则.

Essentially you create a singleton bean, which wraps the knowledge base. When validation requests arrive, you can create knowledge sessions, insert your facts and execute the rules.

它是使用 Spring 构建的,因此如果不使用 Spring,您需要进行的主要更改是确保知识库只创建一次.

It's built with Spring, so the main change you would need to make if not using Spring would be to ensure that the knowledge base is only created once.

这篇关于如何在 jersey rest web 服务中集成 drools的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:如何在 jersey rest web 服务中集成 drools

基础教程推荐