> For the complete documentation index, see [llms.txt](https://docs.miatel.com/api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.miatel.com/api/statistics-api/apache-kafka-bridge.md).

# Apache Kafka Bridge

The Apache Kafka Bridge is designed to duplicate all messages sent through the Miatel platform into the Apache Kafka message bus. Duplication is performed using the Change Data Capture (CDC) mechanism. Messages are serialized in JSON format.

### Access to the Apache Kafka Bridge

Access is only granted via TLS using an ECC private key. \
\
The private key is generated by Miatel. To obtain the key, please contact support at <support@miatel.com>, specifying your Miatel platform account and the IP addresses to be whitelisted, or reach out to your personal manager.

### Message Fields

<table><thead><tr><th width="305"></th><th></th></tr></thead><tbody><tr><td><code>operation</code></td><td>Operation Type (INSERT, UPDATE, DELETE)</td></tr><tr><td><code>sms_hub_mccmnc_id</code></td><td>MCC/MNC code of the recipient</td></tr><tr><td><code>sms_hub_mccmnc_name</code></td><td>Decryption of the MCC/MNC code of the recipient (country and mobile operator name)</td></tr><tr><td><code>sms_hub_sms_time</code></td><td>The time the message was received on the Miatel platform</td></tr><tr><td><code>sms_hub_switch_id</code></td><td>The ordinal number of the Miatel Platform node (form 1 to 4)</td></tr><tr><td><code>src_num</code></td><td>Sender ID</td></tr><tr><td><code>username</code></td><td>Username of the Miatel Platform API</td></tr><tr><td><code>message_body</code></td><td>Message body</td></tr><tr><td><code>segment_num</code></td><td>Segment number</td></tr><tr><td><code>segment_total</code></td><td>Segment total</td></tr><tr><td><code>segment_id</code></td><td>Segment ID (in case of composite message)</td></tr><tr><td><code>dlr_code</code></td><td>Delivery code of the message</td></tr><tr><td><code>dlr_time</code></td><td>Time of message delivery to the recipient</td></tr><tr><td><code>message_id</code></td><td>Message ID</td></tr><tr><td><code>resp_code</code></td><td>Response code from the mobile operator (if available) or from the Miatel platform</td></tr><tr><td><code>dst_num</code></td><td>Recipient's phone number</td></tr><tr><td><code>sms_hub_sms_id</code></td><td>Internal sequential number of the message on the Miatel platform</td></tr><tr><td><code>sms_hub_currency_name</code> </td><td>Currency of billing</td></tr><tr><td><code>price</code></td><td>Message price</td></tr><tr><td><code>remote_ip</code></td><td>IP address of the user of the Miatel Platform API</td></tr><tr><td><code>comment</code></td><td>Campaign name or comment extracted from an incoming HTTP request</td></tr></tbody></table>

### Example of received data

```
{
"operation": "insert",
"schema": "data-sms_hub",
"table": "mdr",
"after": {
        "sms_hub_mccmnc_name": "Singapore - Singtel",
        "sms_hub_sms_time": "2023-03-05T15:20:29Z",
        "sms_hub_switch_id": 1,
        "src_num": "Miatel",
        "sms_hub_mccmnc_id": 525001,
        "username": "user_example",
        "message_body": "Hello",
        "segment_num": 1,
        "price": 0.036,
        "segment_total": 1,
        "dlr_code": 2,
        "message_id": "01d0fce6-bb81-11ed-a40f-9457a0122333",
        "resp_code": 0,
        "dst_num": "6585911223",
        "sms_hub_currency_id": 3,
        "sms_hub_sms_id": 999887766,
        "segment_id": null,
        "sms_hub_currency_name": "EUR",
        "dlr_time": "2023-03-05T15:30:01Z",
        "remote_ip": "127.0.0.1"
        "comment": "Campaign example"
        },
"commit_time": "2023-09-13T12:14:33.287567138Z"
}
```

### Kafka parameters

* Apache Kafka brokers are located in two data centers within the `91.206.88.0/24` network.&#x20;
* Apache Kafka version: 3.5.&#x20;
* Consensus protocol used: KRaft.&#x20;
* Messages are delivered to the topic within 30 seconds after arriving on the Miatel platform.&#x20;
* Messages in Apache Kafka are read transactionally with the read\_committed transaction isolation level.&#x20;
* The key of the message in the topic is the combination of sms\_hub\_sms\_id and sms\_hub\_switch\_id.

###


---

# 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.miatel.com/api/statistics-api/apache-kafka-bridge.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.
