Emitting decision execution events

Apache Kafka is an event framework to connect data systems and transmit data in an efficient and reliable way.

Because Kafka is an open source event framework, it can consume events by using various technologies for different purposes, such as:
  • Real time technical or business monitoring
  • Alerts
  • Logging and auditing
  • Data analytics

You can configure the decision runtime to send an event that contains technical and business information for each decision to a Kafka topic.

Examples of technical information:
  • Decision identification
  • Execution date
  • Execution duration
Examples of business information:
  • Input of the decision
  • Output of the decision

For more information about the configuration, see Configuring the event emitter for an external Kafka instance.

Event data as JSON objects

The decision execution events are JSON objects with attributes:
Table 1. Events
Field Description Type
data.inputParameters Input parameters of the decision. JSONObject
data.outputParameters Output parameters of the decision. JSONObject
decisionId Identifier for the decision. String
decisionOperation Name of the decision operation. String
decisionServiceId Business identifier of the decision service. String
decisionServiceName Business name of the decision service. String
decisionServiceVersion Version of the decision service. String
deploymentSpaceId Identifier of the deployment space of the decision. String
engineApiVersion Version of the decision engine API that is used by the decision runtime. String
executionId Unique identifier for this execution of the decision. String
executionMillis Duration of the decision execution in milliseconds, Long
executedRules List of rules that were executed. Array of strings
executionSuccess Specifies whether the execution of the decision was successful. Boolean
incidentCategory Type of incident that occurred during the execution of the decision String
incidentStackTrace Stack trace for the incident (if available). String
nonExecutedRules List of rules that were not executed. Array of strings
runtimeNodeName Hostname of the decision runtime. String
timestamp Start time of the decision execution request. Long

Example of an emitted event

See the following example of a business event for a decision execution:
{
   "decisionId":"/samples/LoanValidation/LoanValidationDecisionService/3.1.2/LoanValidationDecisionService-3.1.2.jar",
   "decisionOperation":"LoanValidation",
   "decisionServiceId":"samples.LoanValidation",
   "decisionServiceName":"LoanValidation",
   "decisionServiceVersion":"3.1.2",
   "deploymentSpaceId":"test_environment",
   "engineApiVersion":"<decision_engine_api_version_number>",
   "data":{
      "inputParameters":{
         "customer":{
            "age":1,
            "name":"<name>"
         },
         "ageLimit":1
      },
      "outputParameters":"PASSED(mySimple02CustomerDecision)"
   },
   "executedRules":[
      "/LoanValidation/Duration/duration",
      "/LoanValidation/Bankruptcy Score/bankruptcy score",
      "/LoanValidation/Salary Score/salary score",
      "/LoanValidation/Yearly interest rate/yearly interest rate",
      "/LoanValidation/Corporate Score/corporate score",
      "/LoanValidation/Repayment/repayment",
      "/LoanValidation/Grade/grade",
      "/LoanValidation/Insurance/insurance"
   ],
   "executionId":"b4707973-ee80-45cc-bff4-86e3f2b79432",
   "executionMillis":3,
   "executionSuccess":true,
   "incidentCategory":null,
   "incidentId":null,
   "incidentStackTrace":null,
   "nonExecutedRules":[
      "/LoanValidation/Approval/bad score",
      "/LoanValidation/Approval/risky grade",
      "/LoanValidation/Approval/too big Debt to Income ratio",
      "/LoanValidation/Approval/age not valid",
      "/LoanValidation/Approval/no name",
      "/LoanValidation/Approval/wrong SSN",
      "/LoanValidation/Approval/wrong SSN format",
      "/LoanValidation/Approval/wrong zip format",
      "/LoanValidation/Approval/max amount exceeded"
   ],
   "runtimeNodeName":"worker0.mycluster.mycompany.com",
   "timestamp":1605602384767
}

Metadata

Some decision service metadata control the emission of business events:
Table 2. Metadata
Name Description Default Value
businessEventInputEnabled Controls the emission of input parameters in the business data. true
businessEventOutputEnabled Controls the emission of output parameters in the business data. true
businessMonitoringEnabled Controls the emission of business monitoring events. true

Emitting events to Business Automation Insights

To get the information for connecting to Kafka to emit events to Business Automation Insights, see Retrieving information for connection to Kafka.

For information about how to process events based on a customizable configuration, see Decision management event processing walk-through.

For information about event formats, see Business Automation Insights reference.

The configuration parameter event_emitter.enabled is set to true by default only when Business Automation Insights is declared or installed in the same custom resource (CR). For more information about this parameter and other event_emitter.* parameters, see Decision runtime parameters.