Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

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

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

    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

    • What's new in OpenShift Container Platform system management

    • Claude as your performance analysis partner

    • LogAn: Large-scale log analysis with small language models

    • stalld’s BPF Backend: Breaking Free from debugfs

    • Running AI inference on Rebellions ATOM NPU with Red Hat AI

    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
    © 2026 Red Hat

    Red Hat legal and privacy links

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

    Chat Support

    Please log in with your Red Hat account to access chat support.