> For the complete documentation index, see [llms.txt](https://docs.eximee.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eximee.com/documentation/documentation-en/eksploatacja-aplikacji/obsluga-zdarzen/lowcode-do-kafki.md).

# Low-code to Kafka

{% hint style="info" %}
Availability of functionality depends on the license and may not be available in all deployments.
{% endhint %}

## Purpose

Enabling sending messages to the specified Kafka and topic directly from applications (scripts) and BPMN processes (script tasks).

## Usage examples

* Data update in the data warehouse
* Notifying the CRM about process status changes
* Communication with external systems (e.g. bank systems)

## Use in a script/script task

> Please note that the Kafka instance name ("kafkaid" in the example) must be written in lowercase and without special characters.

```js
try {
    api.events.v1.publishAsync(
        "kafkaid",                  // Kafka instance name (configured by the administrator, written only in lowercase, without special characters)
        "topicName",                // topic name (configured by the administrator)    
        {                           // message content – must be valid JSON
            "id": "123",
            "status": {
                "code": "OK",
                "message": "Everything is fine!"
            },
            "list": [1, 2, 3],
            "boolean": true,
            "date": new Date()
        },
        "key",                      // message key (optional – it should be set if we need to preserve the order of events)
        {                           // headers (optional)
            "header1": "header1-value",
            "header2": "header2-value"
        }
    );
} catch (e) {
    // error handling
}
```

## Important information

* Sending is asynchronous – the script does not wait for confirmation of message delivery
* Remember to handle exceptions. The function may throw an error if there is no connection to Kafka or if the message buffer in the application overflows
* Successful execution of the function confirms that the message was added to the buffer, but does not guarantee that the message is sent without errors. We are unable to catch errors of the sending itself
* The message content must be valid JSON – the passed object is automatically serialized
* The key is optional, but recommended when you care about message order within a single partition
* The sending timeout is configured by the administrator – it cannot be changed from the script
* Topics are created and managed by administrators
* `kafkaId` must match the name of the Kafka instance configured in the application


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.eximee.com/documentation/documentation-en/eksploatacja-aplikacji/obsluga-zdarzen/lowcode-do-kafki.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
