Skip to content

kenthua/brms-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 

Repository files navigation

JBoss BRMS Examples

Tested on JBoss BRMS v6.2

Installation

  • copy .niogit from the support folder to EAP_HOME/bin
  • Follow the instructions in the following knowledge base article
    • Sample properties
    <property name="org.kie.server.user" value="brmsAdmin"></property>
    <property name="org.kie.server.pwd" value="passw0rd!"></property>
    <property name="org.kie.server.location" value="http://localhost:8080/kie-server/services/rest/server"></property>
    <property name="org.kie.server.controller" value="http://localhost:8080/business-central/rest/controller"></property>
    <property name="org.kie.server.controller.user" value="kieserver"></property>
    <property name="org.kie.server.controller.pwd" value="kieserver1!"></property>
    <property name="org.jbpm.server.ext.disabled" value="true"></property>
    <property name="org.kie.server.id" value="local-server"></property>
  • In your EAP configuration EAP_HOME/standalone/configuration/application-roles.properties
  • Your user must have the "kie-server" role
  • Build & Deploy specific rule projects
    • example / Examples / brms
    • example / Examples / iteration

Rule Execution Server Creation (Realtime Decision Server)

  • From Business Central
  • Click the "+" to the right of your new "local-server", this will create the container
    • Name: [container_name]
    • Valid GAV (get this from the Project Editor of your project) / or use the search mechanism, search for: [gav]
    • Click the radio button of your new container and click Start on the right

Rule examples - general (brms)

  • example / Examples / brms
  • Rule execution server container settings
    • Group Name: com.redhat.test
    • Artifact Id: brms
    • Version: 1.0

Rule example - data model with collection (iteration)

  • example / Examples / iteration
  • Rule execution server container settings
    • Group Name: com.redhat.test
    • Artifact Id: iteration
    • Version: 1.0

Rule Execution Server Payload Generation

Invoking the Rule Execution Server from REST Client

Rule Execution / Testing - Non-execution server

NOT TESTED FOR BRMS 6.2

  • Build the brms-demo project as a war and add to the EAP_HOME/standalone/deployments folder
    • Build & Deploy rule project
    • BRMSServiceImpl has a main method, just run the class by itself via JBDS
    • OR
    • brms-demo project -> mvn package
    • copy the .war in the target folder (EAP_HOME/standalone/deployments)
    • http://localhost:8080/brms-demo/ListenServlet
      • Listen Servlet initializes test data
      • BRMSServiceImpl calls for a ksession, copies data from model to BRMS fact
      • Depends kmodule/jar being generated by JBoss BRMS for fact model
      • Once executed will run through rules written for the data
  • Don't expect anything in return, watch the EAP system out (server.log) for messages of rules being executed.

Payload Example - brms

<batch-execution lookup="defaultKieSession">
  <insert out-identifier="customer-identifier" return-object="true" entry-point="DEFAULT">
    <com.redhat.test.brms.Customer>
      <accountCount>0</accountCount>
      <firstName>John</firstName>
      <lastName>Doe</lastName>
    </com.redhat.test.brms.Customer>
  </insert>
  <insert out-identifier="account1-identifier" return-object="true" entry-point="DEFAULT">
    <com.redhat.test.brms.Account>
      <balance>100.0</balance>
      <customer reference="../../../insert/com.redhat.test.brms.Customer"/>
      <number>C-12345</number>
      <type>CHECKING</type>
    </com.redhat.test.brms.Account>
  </insert>
  <insert out-identifier="account2-identifier" return-object="true" entry-point="DEFAULT">
    <com.redhat.test.brms.Account>
      <balance>200.0</balance>
      <customer reference="../../../insert/com.redhat.test.brms.Customer"/>
      <number>C-67890</number>
      <type>CHECKING</type>
    </com.redhat.test.brms.Account>
  </insert>
  <fire-all-rules out-identifier="fire-identifier"/>
</batch-execution>

Payload Example - iteration

<batch-execution lookup="defaultKieSession">
  <insert out-identifier="insert-identifier" return-object="true" entry-point="DEFAULT">
    <com.redhat.test.iteration.Customer>
      <accounts>
        <com.redhat.test.iteration.Account>
          <balance>10.0</balance>
          <type>CHECKING</type>
        </com.redhat.test.iteration.Account>
        <com.redhat.test.iteration.Account>
          <balance>20.0</balance>
          <type>CHECKING</type>
        </com.redhat.test.iteration.Account>
      </accounts>
      <firstName>John</firstName>
      <id>1</id>
    </com.redhat.test.iteration.Customer>
  </insert>
  <fire-all-rules out-identifier="fire-identifier"/>
</batch-execution>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages