Skip to main content
Redhat Developers  Logo
  • Products

    Platforms

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat AI
      Red Hat AI
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • View All Red Hat Products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat Developer Hub
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat OpenShift Local
    • Red Hat Developer Sandbox

      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Secure Development & Architectures

      • Security
      • Secure coding
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • Product Documentation
    • API Catalog
    • Legacy Documentation
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Demystifying the Red Hat Decision Manager and Process Automation Manager Remote Client

December 10, 2018
Duncan Doyle
Related topics:
Java
Related products:
Developer Tools

Share:

    KIE-Server is the light-weight, cloud-native, rules and process execution runtime of the Red Hat Decision Manager (RHDM) and Red Hat Process Automation Manager (RHPAM) platforms. Lately, I've gotten more and more questions on how to use the KIE-Server Client Java API to interact with the KIE-Server execution runtime of RHDM (formerly called Red Hat JBoss BRMS) and RHPAM (RHPAM). To answers these questions, and to create a future reference, I decided to write a number of code examples, accompanied by this article.

    The KIE-Server Client Java API provides an easy way for Java applications to communicate with the KIE-Server execution engine of RHDM and RHPAM. The API abstracts the application from the underlying REST and/or JMS communication protocol and transport, making integrations with the server easier to build, test, and maintain.

    What is the KIE-Server Client?

    The KIE-Server Client is a small, lightweight Java library, providing a pure Java API, that allows Java clients to interact with Red Hat Decision Manager and RHPAM execution servers over a RESTful (or JMS) communication channel. This abstracts the client from the marshaling of the request and response data into the format that the execution server expects (either JSON, JAXB, or XSTREAM), as well as the handling of sending requests and receiving responses over HTTP (or via a JMS Broker when using the JMS API). This greatly simplifies the code of Java clients that want to interact with our platforms.

    The API

    Let's first look at the API itself. The API is structured around the KieServicesClient. The KieServicesClient is one of the main components that can be built from the KieServicesFactory, and it gives us access to the various runtimes that KIE-Server provides. KIE-Server uses a plug-in based system, and every functionality of the platform is provided through plug-ins.

    For each plugin that exposes a remote interface, the client provides a matching client-side service. For example, to execute rules via the KIE-Server rules engine, we use the RuleServicesClient, Decision Model and Notation (DMN) models are evaluated with the DMNServicesClient, and interaction with the process engine is done via the ProcessServicesClient. Other available clients are:

    • CaseServicesClient to interact with the Case Management system
    • UserTaskServicesClient to interact with the process engine's UserTask engine
    • QueryServicesClient to execute queries against the server
    • SolverServicesClient to integrate with the OptaPlanner capabilities

    And there are various administration clients.

    The code below shows how a specific client, in this case, a ProcessServicesClient, can be retrieved from the main KieServicesClient:

    KieServicesClient kieServicesClient = KieServicesFactory.newKieServicesClient(kieServicesConfig);
    ProcessServicesClientprocessClient=kieServicesClient.getServicesClient(ProcessServicesClient.class);

    The various remote client APIs, where possible, are very close to the standard Java APIs that KIE, Drools, Red Hat JBoss Frameworks (formerly Red Hat JBoss jBPM), and OptaPlanner expose. However, there are some differences that users need to be aware of.

    Using the right KIE-Session

    When using Decision Manager/Drools as an embedded library, a KieSession, the session in which you insert data and executes rule, is retrieved from a KieContainer. The KieContainer API allows you to select the specific KieSession you want to use. Different KieSessions can be configured in the kmodule.xml deployment descriptor of the rules deployment unit (the KJAR). This allows us to define and configure different kinds of sessions, for example, stateless KieSessions, stateful KieSessions, or KieSessions that use a pseudo-clock—whatever our use-case requires.

    Selecting the right KieSession when using the remote KIE-Server Client is done differently, because the API does not expose the KieContainer. Instead, we need to specify the "ID" of the KieSession to be used in a BatchExecutorCommand, as shown here:

    BatchExecutionCommand batchExecutionCommand = commandFactory.newBatchExecution(commands, "default-stateless-kiession");

    This will result in a JSON payload that contains a "lookup" entry, which tells the KIE-Server which session to use for the given request:

    {
      "lookup" : "default-stateless-ksession",
      "commands" : [ {

    The ID should match the ID of a KieSession defined in the KJAR's kmodule.xml, as shown here:

    <kmodule xmlns="http://www.drools.org/xsd/kmodule" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <kbase name="default-kbase" default="true" eventProcessingMode="cloud" equalsBehavior="equality">
        <ksession name="default-stateless-ksession" type="stateless" default="true" clockType="realtime"/>
      </kbase>
    </kmodule>

    When using the remote client API, it is recommended to use stateless KieSessions, unless your use-case explicitly requires stateful sessions.

    Marshaling and custom data types

    When using a remote API, data needs to be sent from the client to the server in a format that both parties understand. KIE-Server supports three formats: JSON, JAXB, and XSTREAM. Some of the KIE-Server APIs, for example, the API to start a business process, accept generic datatypes as input, such as a Map. This Map is used to send process start variables to the process execution engine.

    When our process variables consist of custom defined datatypes, for example, Applicant or Loan, we need to register these datatypes with the KIE-Server Client. This allows the Marshaller component to correctly marshal and unmarshal these datatypes when communicating with the remote KIE-Server. Java classes can simply be registered via the KieServicesConfiguration, as shown here:

    KieServicesConfiguration kieServicesConfig = KieServicesFactory.newRestConfiguration(KIE_SERVER_URL, credentialsProvider);
    Set<Class<?>> extraClasses = new HashSet<>();
    extraClasses.add(Application.class);
    extraClasses.add(Applicant.class);
    extraClasses.add(Property.class);
    kieServicesConfig.addExtraClasses(extraClasses);

    Examples

    In this GitHub repository, I've collected three examples of KIE-Server Clients that communicate with remote services on the KIE-Server. The examples show how to:

    • Start a business process.
    • Execute rules.
    • Evaluate a DMN model.

    Three Main classes are provided that demonstrate the usage of the API. Comments in the code provide further explanation of the APIs being used.

    Conclusion

    This article provided a brief introduction to the KIE-Server Client Java API, provided some tips and tricks for how to best use the API, and concluded with examples that demonstrate how to start a process, execute rules, and evaluate a DMN model.

    Here are related articles that might be of interest:

    • Quickly try Red Hat Decision Manager in your cloud
    • Quickly try Red Hat Process Automation Manager in your cloud
    • Spring Boot-enabled business process automation with Red Hat Process Automation Manager

    Duncan Doyle

    About the author:

    Duncan Doyle is the Technical Marketing Manager for the Decision Manager and Process Automation Manager platforms at Red Hat. With a background in Red Hat Consulting and Services, Duncan has worked extensively with large Red Hat customers to build advanced, open-source, business-rules and business process management solutions.

    He has a strong background in technologies and concepts such as Service Oriented Architecture, Continuous Integration and Delivery, rules engines, and BPM platforms and is a subject matter expert (SME) on multiple JBoss Middleware technologies, including, but not limited to, JBoss EAP, HornetQ, Fuse, DataGrid, BRMS, and BPMSuite. When he’s not working on open-source solutions and technology, he is building Lego with his son and daughter or jamming along some 90’s rock-music on his Fender Stratocaster.

    Last updated: January 22, 2024

    Recent Posts

    • Kubernetes MCP server: AI-powered cluster management

    • Unlocking the power of OpenShift Service Mesh 3

    • Run DialoGPT-small on OpenShift AI for internal model testing

    • Skopeo: The unsung hero of Linux container-tools

    • Automate certificate management in OpenShift

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2025 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue