@itentialopensource/apache-kafka-library-example

1.0.6-2023.2.1 • Public • Published

Apache - Kafka - Library - Example

Overview

This Pre-Built Automation bundle contains example use cases that are applicable when Itential Automation Platform is integrated with Apache Kafka using the kafka-node npm library. Because every environment is different, these use cases are fully functioning examples that can be easily modified to operate in your specific environment. These workflows have been written with modularity in mind to make them easy to understand and simple to modify to suit your needs.

Example Workflows

Name Overview
Consume Message - Kafka - Library - Example

This example use case consumes Kafka messages on a given topic and triggers a job from an IAP Operations Manager Event Trigger along with passing message data to that job's context.

The Apache - Kafka - Library Pre-Built provides a modular worfklow that writes to a topic in Apache which then writes to a message queue in IAP's Event System.

In order to subscribe to the relevant event topic, one must configure the adapter-kafka service configuration's topic properties correctly.

The following topic properties is an example of setting the adapter-kafka service configuration so that the adapter subscribes to the Kafka event topic kafka-example-topic, does not filter messages based on any text, and subscribes as well to the IAP Event System topic iap-example-topic:

"topics": [
  {
    "name": "kafka-example-topic",
    "always": true,
    "subscriberInfo": [
      {
        "subname": "default",
        "filters": [],
        "rabbit": "iap-example-topic",
        "throttle": {}
      }
    ]
  }
]

Note when a new topic is set in the service configuration, a new topic is written to file in the adapter-kafka directory in the file .topics-<kafka-adapter-name>.json. If the Consume Message - Kafka - Library worfklow is not being triggered, this file may not have yet been updated with the expected topic.

On setting the adapter-kafka service configuration as shown above, navigate to the Consume Message - Kafka - Library - Example Operations Manager automation, click on the Trigger Consume Message - Kafka - Example - Trigger and select under Event the topic that was set in the adapter service configuration. The event topic based on service configuration above would be iap-example-topic - @itentialopensource/adapter-kafka.

To then produce a message to the topic set, run the modular workflow from the Apache - Kafka - Library Pre-Built Produce Message - Kafka - Library. To produce a message to the topic configured above, provide inputs such as the following:

{
  "adapterId": "kafka",
  "topic": "kafka-example-topic",
  "messages": [
    "This is a message sent to topic kafka-example-topic and will then be picked up eventually by IAP's Event System in the topic iap-example-topic"
  ],
  "suppressMessage": true
}

Upon the Send Message task completing in this workflow, there will be a job started from the workflow Consume Message - Kafka - Library of this Pre-Built that can be viewed in Operations Manager in the Jobs panel.

Note the Trigger Consume Message - Kafka - Example - Trigger defaults to the kafka - @itentialopensource/adapter-kafka event topic, which would correspond to the following adapter-kafka service configuration:

"topics": [
  {
    "name": "kafka-example-topic",
    "always": true,
    "subscriberInfo": [
      {
        "subname": "default",
        "filters": [],
        "rabbit": "kafka",
        "throttle": {}
      }
    ]
  }
]

External Dependencies

Name OS Version API Version
Apache Kafka

Adapters

Name Version Configuration Notes
adapter-kafka ^0.5.0

Readme

Keywords

Package Sidebar

Install

npm i @itentialopensource/apache-kafka-library-example

Weekly Downloads

11

Version

1.0.6-2023.2.1

License

Apache-2.0

Unpacked Size

74.4 kB

Total Files

16

Last publish

Collaborators

  • andyknaebel
  • johnpolansky
  • jared.obrien
  • charlie.wilson
  • zack.strulovitch
  • itential-ci