LogoLogo
API Documentation
Version 1.19.5 and Older
Version 1.19.5 and Older
  • DecisionRules Documentation
  • API
    • API Introduction
    • API Keys
      • Solver API Keys
      • Management API keys
      • BI API keys
    • Rule Solver API
    • Management API
      • Deprecated Endpoints
    • Console Logs API
    • Business Intelligence API
      • Deprecated Endpoints
    • Datacenters & Locations
      • Global Cloud
      • Regional Cloud
    • Apache Kafka Solver API
    • Endpoint Settings
    • Archive
      • Rule Flow Solver API (DEPRECATED)
  • Decision tables
    • Decision Tables Introduction
    • Table Designer
    • Input & Output JSON Model
      • Simple Editor
      • JSON Editor
      • Binding to Model
    • Supported Data Types
    • Operators and Functions
      • Basic operators
      • Date operators
      • Functions
        • Logical Functions
        • Math Functions
        • Date and Time Functions
        • Text Functions
        • Data Functions
        • Array Functions
        • Integration functions
        • Functions and JSON
    • Export & Import of Decision Tables
      • Export Decision Table
      • Import Decision Table
      • File Structure of JSON Format
      • Managing Decision Table in Excel/Google Sheets
      • Deprecated Formats: XLSX v.1 and CSV
    • Table Operations
      • Filter Values
      • Valid Values
      • Sorting
  • Decision Trees
    • Decision Trees Introduction
    • Decision Tree Designer
    • Export & Import Decision Trees
      • Export Decision Tree
      • Import Decision Tree
  • Scripting Rules
    • Scripting Rule Introduction
    • Custom functions in Scripting Rules
    • Calling external API within ScriptingRules
    • Use Rule Variables in Scripting Rules
    • Call Embedded Rules in Scripting Rules
    • Export & Import Scripting Rules
      • Export Scripting Rule
      • Import Scripting Rule
    • Tips
  • Rule Flow
    • Rule Flow Designer
    • Rule Flow Mapping
    • Rule States in Rule Flow
    • Warnings & Errors
    • Rule Flow Limits
    • Export & Import Rule Flows
      • Export Rule Flow
      • Import Rule Flow
  • Workflow
    • Workflow Introduction
    • Workflow Designer
    • Workflow Nodes Overview
    • Workflow Limits
  • Other
    • Rule Alias
    • Execution Strategy
    • Rule State
    • Rule Versioning
    • Favorite Rules
    • Rule Variables
    • Rule Comparison
      • Decision Table Comparison
      • Decision Tree Comparison
      • Scripting Rule Comparison
    • Rule Tags
    • Rule Dependencies
    • Test Bench
    • Single Sign-On (SSO)
    • Event timeline
    • Rule Lock
    • Rule Migration Strategies
    • Changes in Version 1.19.0 (10/2024)
  • Organizations
    • Introduction
      • Access to Organization
    • Structure
      • Organization Roles
      • Members
      • Teams
      • Spaces
      • Space Roles
      • Policies
      • Settings
  • Teamwork
    • Dashboard
    • Folders
    • Spaces
    • Manage Spaces
    • Share Rules Between Spaces
    • Users & Roles
    • Teamwork Indicator
  • SDK and Integrations
    • Languages / Frameworks
      • SQL Server
      • Oracle PL/SQL
      • PostgreSQL
      • JavaScript
      • Java Spring Example
      • PHP Library
      • Python Library
      • .NET Library
      • Google Tag Manager
    • Excel Add-in
  • Business Intelligence
    • Audit Logs
    • Create a Power BI Report
    • Connect Power BI to Business Intelligence API
    • Connecting from Power BI (deprecated)
    • Connect DecisionRules to Power BI Using Our Custom Connector
  • Billing
    • Invoices & Billing
    • Change Product Plan
    • Billing Information
    • Plan Limits Explained
  • Regional Cloud
    • Regional Cloud
    • Region Specific API URLs
  • On-Premise / Docker
    • Environment Variables
    • Redis Connection Modes
    • Setup Single Sign-On (SSO)
      • Set up Microsoft Entra ID SSO
      • Set up Google SSO
    • DecisionRules Application
      • Minimal Requirements
      • DecisionRules Server
      • DecisionRules Client
      • DecisionRules Business Intelligence
      • Networking Between Docker Containers
    • Docker Showcase App
      • Showcase
      • Showcase + Business Intelligence
    • AWS Setup
      • AWS ECS/Fargate
      • Cache - Amazon ElastiCache
    • Microsoft Azure Setup
      • Database - Azure CosmosDB
      • Cache - Azure Cache for Redis
      • Azure Container Apps
    • Azure Red Hat OpenShift
    • Google Kubernetes Engine (GKE)
    • Kubernetes Setup
      • Kubernetes Setup with Business Intelligence
    • Logging options
    • CD/CI Pipelines
      • Azure DevOps CICD Pipelines
      • Using Migration script (old way)
    • Offline License
  • Terms & Conditions
    • Terms and Conditions
    • Privacy Policy
    • Service Level Agreement
      • Community Support
      • Standard Cloud (SaaS)
      • Silver SLA
      • Gold SLA
      • Custom SLA
    • Sub-Processor List
  • Roadmap 🚲 🗺️
  • Release Notes
    • Public Cloud
    • On-Premise / Private Cloud
Powered by GitBook
On this page
  • Setting up Apache Kafka Solver API
  • Before you start using the Kafka Solver API
  • Information for connecting to Kafka Cluster
  • Example Connection Config
  • How to communicate from a client application using Kafka Messsages
  • Producing data to Request Topic
  • Consuming Data from Response Topic

Was this helpful?

  1. API

Apache Kafka Solver API

Was this helpful?

DecisionRules.io supports asynchronous calls to the Rule Solver. This option should be used if your infrastructure is based on asynchronous message processing.

Setting up Apache Kafka Solver API

Kafka Solver API is now available both in the cloud and on premise.

Before you start using the Kafka Solver API

In the cloud, it is necessary to enable Kafka Solver for a specific customer manually. If you are interested, please contact us at sales@decisionrules.io

  1. Request access rights for your client application to the DecisionRules Kafka Cluster at sales@decisionrules.io

  2. Configure the connection of your client application to the Kafka cluster.

  3. Register on the assigned Kafka topic, where you will receive the results.

  4. Sending input data to the input Kafka Topic, from which DecisionRules takes it.

Information for connecting to Kafka Cluster

Key
Value

broker

pkc-lq8v7.eu-central-1.aws.confluent.cloud:9092

ssl

true

sasl.mechanism

plain

sasl.username

contact us on sales@decisionrules.io

sasl.password

contact us on sales@decisionrules.io

Example Connection Config

Java Configuration

config.properties
# Required connection configs for Kafka producer, consumer, and admin
bootstrap.servers=pkc-lq8v7.eu-central-1.aws.confluent.cloud:9092
security.protocol=SASL_SSL
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule   required username='{{ CLUSTER_API_KEY }}'   password='{{ CLUSTER_API_SECRET }}';
sasl.mechanism=PLAIN
# Required for correctness in Apache Kafka clients prior to 2.6
client.dns.lookup=use_all_dns_ips

# Best practice for Kafka producer to prevent data loss
acks=all

Python Configuration

config.py
# Kafka
bootstrap.servers=pkc-lq8v7.eu-central-1.aws.confluent.cloud:9092
security.protocol=SASL_SSL
sasl.mechanisms=PLAIN
sasl.username={{ CLUSTER_API_KEY }}
sasl.password={{ CLUSTER_API_SECRET }}

How to communicate from a client application using Kafka Messsages

DecisionRules.io always uses two Kafka topics to communicate with the client application.

  • Response Topic (read-only)

    • Topic on which your client application listens

    • You will receive the evaluated data in this topic

  • Request Topic (write)

    • Kafka Topic into which you write data for evaluating DecisionRules

    • DecisionRules is listening on this topic

Name
Example Topic Name
Permissions

Request Topic

{company}-{random_number}-request

WRITE

Response Topic

{company}-{random_number}-response

READ

Producing data to Request Topic

Message Headers

Header
Description

api-key

(mandatory)

rule-id OR ruleflow-id

(mandatory)

Rule or RuleFlow ID

x-correlation-id

(optional)

User-generated ID to help you correlate input and output data.

version

(optional)

Version of the rule you want to solve.

Message Data

Message Attribute
Description

Key

<empty>

Value

JSON object filled according to the data model called by Rule or RuleFlow

Example Request Data

Message Value Example (JSON Object)
{
  "client": {
    "age": 12
  }
}

Message Data Schema

Request Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {},
  "required": []
}

Consuming Data from Response Topic

Attribute
Type
Description

data

Array

Field filled with data according to the rule evaluation. One element in the array means one result. For example, if multiple rows are matched when evaluating a decision table, they are returned as array items

errors

Array

If an error occurs in the evaluation for any reason, each error is added to the error field.

If there are no errors in the evaluation, the "errors" attribute is not returned.

The contents of the "data" field will be empty when any error is returned.

correlationId

String

(optional) If the "x-correlation-id" header was filled in the input message, this value is available in the output message.

If "x-correlation-id" is not filled in the input, the attribute is not present in the output.

Example Response Data

Single data
{
  "data": [
    {
      "totalProducts": 2,
      "amountPerProduct": 500,
      "segment": "mass-market",
      "profitability": 1.2
    }
  ],
  "correlationId": "ef429e33-f2c4-41ad-b9f3-cad12ea3b95e"
}
Multiple data
{
  "data": [
    {
      "totalProducts": 2,
      "amountPerProduct": 500,
      "segment": "mass-market",
      "profitability": 1.2
    },
    {
      "totalProducts": 1,
      "amountPerProduct": 300,
      "segment": "mass-market",
      "profitability": 1.53
    }
  ],
  "correlationId": "12429e33-f2c4-41ad-b9f3-cad12ea3b95e"
}
Error response
{
  "errors": [
    {
      "code": 500,
      "message": "This Rule Flow belongs to another user OR Rule Flow not found"
    }
  ],
  "data": [],
  "correlationId": "ef429e33-f2c4-41ad-b9f3-cad12ea3b95e"
}

Message Data Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "data": {
      "type": "array",
      "items": [
        {
          "type": "object"
        }
      ]
    },
    "correlationId": {
      "type": "string"
    },
    "errors": {
      "type": "array",
      "items": [
        {
          "type": "object",
          "properties": {
            "code": {
              "type": "integer"
            },
            "message": {
              "type": "string"
            }
          },
          "required": [
            "code",
            "message"
          ]
        }
      ]
    }
  },
  "required": []
}

Solver API Key. Generate your api key in the

Page cover image
dashboard