Samples > Rule Execution Server Integration > How to Automate Ruleset Management

This sample will show you how to perform a number of ruleset management tasks, including deployment and ruleset management from a running Rule Execution Server.

To deploy and fetch rulesets, the sample uses JMX technology to remotely manage the Management Beans (MBeans) on the Rule Execution Server.

Remote JMX access uses the IlrBresModelMbean, which acts as an interface for the Rule Execution Server management model. The Rule Execution Server model provides a way to create, list, remove and modify the different management entities. It also provides some facilities for processing and retrieving RuleApp Archives.

The sample is implemented for several application servers that differ in their remote JMX API: BEA WebLogic Server 9.2 and 10.0, IBM WebSphere 6.1, and JBoss 4.0.x, which is the Samples Server we provide.

Key Features

Key features include:

Installing the Sample

Installing the sample requires the Rule Execution Server Console.

To install the sample:

  1. Deploy the Rule Execution Server Console:
  2. Using the Samples Server: Start the Samples Console. The Samples Server is automatically started in the Samples Console and the Rule Execution Server is pre deployed in the Samples Server.
    Using other supported application servers: Before executing this code sample, you must deploy the Rule Execution Server on your application server. See Installing JRules Modules.
  3. After deploying the Rule Execution Server, open a Web browser and enter one of the following URLs to open the Rule Execution Server console login page for your application server:
  4. Samples Server: http://localhost:8080/bres
    WebLogic 9.2/10.0: http://localhost:7001/bres
    WebSphere 6.1: http://localhost:9080/bres
    JBoss 4.0: http://localhost:8080/bres
    SUN AS 82: http://localhost:8080/bres
  5. Login to the Rule Execution Server using the following details:
  6. Username bres
    Password bres
  7. Click the Explorer tab to display the list of RuleApp Archives deployed on the Rule Execution Server.
  8. If you are not using the Samples Server, you need to configure the sample property files, as follows:
  9. WebLogic:
    <InstallDir>/executionserver/samples/jmxremote/weblogic92|100/build.properties:
    WL_HOME=${env.WL_HOME}. By default the variable is set to your WL_HOME environment variable.
    server.url=t3://localhost:7001. Specifies the URL where the Rule Execution Server Console is deployed.
    server.user=bres. Sets the user login.
    server.password=bres. Sets the user password.
    WebSphere 6.1:
    <InstallDir>/executionserver/samples/jmxremote/websphere6/build.properties:
    WAS_HOME=${env.WAS_HOME}. By default the variable is set to your WAS_HOME environment variable.
    server.host=localhost. The SOAP hostname.
    server.port=8880. The SOAP port number.
    server.user=bres. Sets the user login.
    server.password=bres. Sets the user password.
    server.profile.name=default. The WebSphere profile name where the Rule Execution Server Console is deployed.
    JBoss:
    <InstallDir>/executionserver/samples/jmxremote/jboss40/build.properties:
    JBOSS_HOME=${basedir}/../shared/tools/jboss. By default the variable is set to the JRules embedded JBoss server.
    jboss.config=jrulessamples. Specifies the JBoss configuration to use.
    Sun AS 82:
    <InstallDir>/executionserver/samples/jmxremote/sunas82/build.properties:
    SUNAS82_HOME=${env.SUNAS82_HOME}. By default the variable is set to your SUNAS82_HOME environment variable.
    Modify the following variables to match your environment:
    server.host=localhost Set the hostname.
    server.port=8686 Sets the port number.
    server.user=admin Sets the user.
    server.pwd=admin Sets the password.
    server.useTLS=false
  10. If you are not using the Samples Server, you need to build the Java client classes, as follows:
    1. Go to the Samples Console and locate the sample: executionserver > jmxremote > <APPLICATION_SERVER_NAME>
    2. Execute the build command.

Running the Sample

The sample can only be run through the Samples Console.

To run the sample:

  1. Go to the Samples Console and locate the sample: executionserver > jmxremote > <APPLICATION_SERVER_NAME>
  2. where <APPLICATION_SERVER_NAME> is one of the following:
    - weblogic92 for WebLogic 9.2
    - weblogic100 for WebLogic 10.0
    - websphere6 for WebSphere 6.1
    - jboss40 for JBoss 4.0
    - sunas82 for SUN AS 82
  3. Execute the run command. This command:
    1. Connects to the server.
    2. Gets server information.
    3. Deploys the samples/jmxremote/data/JmxRuleappSample.jar RuleApp Archive on the Rule Execution Server.
    4. Displays the content of the JmxRuleappSample RuleApp
  4. Execute the displayruleapp command to display the contents of the RuleApp in the Rule Execution Server.

Source Files

The sample is located in <InstallDir>/executionserver/samples/jmxremote.

Because application servers such as BEA WebLogic and IBM WebSphere are currently using their own proprietary connections, they do not yet fully comply with the JSR 160: JavaTM Management Extensions (JMX) Remote API 1.0 standard (http://jcp.org/en/jsr/detail?id=160). Therefore, the method used to manage and retrieve Java Beans information on the Rule Execution Server is slightly different to the method specified by Java Management Extensions (JMX) 1.2.

Highlights

The goal of the Rule Execution Server JMX infrastructure is to provide a standard way to deploy, manage, and monitor the execution resources of the Rule Execution Server. The various MBeans of the Rule Execution Server model are the run-time proxies on each entity of the Rule Execution Server model.

The following graphic illustrates the infrastructure of the management mode.

Infrastructure of the management mode.

Rebuilding the Sample

The sample is rebuilt through the Samples Console.

To rebuild the sample:

  1. Go to the Samples Console and locate the sample: executionserver > jmxremote > <APPLICATION_SERVER_NAME>
  2. where <APPLICATION_SERVER_NAME> is one of the following:
    - weblogic92 for WebLogic 9.2
    - weblogic100 for WebLogic 10.0
    - websphere6 for WebSphere 6.1
    - jboss40 for JBoss 4.0
    - sunas82 for SUN AS 82
  3. Execute the build command to build the Java client classes.

Related Concepts

Management and Monitoring

Related Tasks

Deploying and Exporting RuleApps