GithubHelp home page GithubHelp logo

brms-example's Introduction

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>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.