Jboss Rule Engine KIE Drools 6.3.0 Final tutorial (3)

Source: Internet
Author: User

Jboss Rule Engine KIE Drools 6.3.0 Final tutorial (3)

The first two tutorials show you how to run the. drools file locally and use the stateless method to access the rules on remote repository. KIE Drools also provides a stateful-stateful access method.

Running rules on a KIE-DROOLS-another way of writing code first
String url = "http://192.168.0.101:8080/kie-drools/maven2/org/sky/drools/ApprovalDecision/1.0.0/ApprovalDecision-1.0.0.jar";KieServices ks = KieServices.Factory.get();KieRepository kr = ks.getRepository();UrlResource urlResource = (UrlResource) ks.getResources().newUrlResource(url);urlResource.setUsername("tomcat");urlResource.setPassword("tomcat");urlResource.setBasicAuthentication("enabled");InputStream is = urlResource.getInputStream();KieModule kModule = kr.addKieModule(ks.getResources().newInputStreamResource(is));KieContainer kContainer = ks.newKieContainer(kModule.getReleaseId());KieSession kieSession = kContainer.newKieSession();try {PaymentInfo m = new PaymentInfo();m.setMoneyAmount(10000);kieSession.insert(m);kieSession.fireAllRules();System.out.println(m.getDecisionPath());} catch (Exception e) {e.printStackTrace();} finally {try {kieSession.dispose();} catch (Exception e) {}}

The difference is:
This is a stateful (stateful) session call. In the example in the previous tutorial, we are a stateless call.

Stateful VS StatelessStateless

That is, stateless call. For example, the value in fact a is initially 0. After the rule is executed, the connection is automatically disconnected and released.

Stateful

There is A status call. For example, if the value in fact a is initially 0, when A Request changes its value to 20, when the Code does not display the call to dispose, this value will be maintained all the time.

Therefore, after the Stateful Session is called, disable and release it manually. The following code is displayed:

finally {    try {    kieSession.dispose();    } catch (Exception e) {    }}
The first step towards SOA is to review the "BRMS-based system logic architecture"

Let's look back at the following three sentences:

The return of the IT staff is the same, and the business is handed over to the business developers. The IT staff only focus on the technical implementation;

Reduce the complexity of technical integration in products and projects;

IT is easy to develop experts in the field: IT developers only need to focus on one of their own fields, such as process development experts, database experts, special effect programmers at the front end, system implementation, integration, and management experts.

Typical application scenarios of combining rules with BPM (workflow)

Still do not understand? It doesn't matter. Let's look at the following example.

When the process is transferred to "when the employee submits the reimbursement amount", there is a Debian node, which returns "path (M or GM )", once this value is obtained for the demo-path of BPM, BPM automatically determines whether the next process is submitted to the Manager for approval or submitted to the General Manager for approval.
I hope you can use this example to understand what IT means to quickly respond to frequent business changes, what is 24*7, and what IT means to accelerate business to the market.

What is SOA

What does SOA mean for business and sales personnel? What does SOA mean for business personnel of enterprises and customers?

What does soa mean to it developers?

'

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.