> For the complete documentation index, see [llms.txt](https://docs.cybus.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cybus.io/data-flows/service-commissioning-files/resources/cybus-endpoint.md).

# Cybus::Endpoint

Read, write, or subscribe to one data point of a machine or system, and exchange its values over MQTT.

The **Cybus::Endpoint** resource addresses one data point on a [Cybus::Connection](https://docs.cybus.io/data-flows/service-commissioning-files/resources/cybus-connection.md), such as an OPC UA node or a Modbus register. You set the address and the operation in [subscribe, read, or write](#subscribe-read-write).

Each endpoint has exactly one MQTT topic. Connectware builds it as follows:

* If you set [topic](#topic), the topic is `<prefix>/<topic>`. The prefix is [Cybus::MqttRoot](https://docs.cybus.io/data-flows/service-commissioning-files/parameters.md#cybus-mqttroot), which is `services/<serviceId>` by default.
* If you set [asset](#asset), the topic is the topic of that asset property in a Unified Namespace.
* Otherwise, the topic is `<prefix>/<resource ID>`.

In most services, a [Cybus::Mapping](https://docs.cybus.io/data-flows/service-commissioning-files/resources/cybus-mapping.md) then routes the endpoint data to the topics that dashboards, applications, or other services consume.

## Endpoint Properties

| Property                           | Type       | Required     |
| ---------------------------------- | ---------- | ------------ |
| [protocol](#protocol)              | `enum`     | **Required** |
| [connection](#connection)          | `string`   | **Required** |
| [subscribe](#subscribe-read-write) | `object`   | Optional\*   |
| [read](#subscribe-read-write)      | `object`   | Optional\*   |
| [write](#subscribe-read-write)     | `object`   | Optional\*   |
| [rules](#rules)                    | `object[]` | Optional     |
| [qos](#qos)                        | `integer`  | Optional     |
| [retain](#retain)                  | `boolean`  | Optional     |
| [targetState](#targetstate)        | `enum`     | Optional     |
| [topic](#topic)                    | `string`   | Optional     |
| [asset](#asset)                    | `string`   | Optional     |
| [agentName](#agentname)            | `string`   | Ignored      |
| [buffering](#buffering)            | `object`   | Optional     |
| [inputBuffering](#inputbuffering)  | `object`   | Optional     |
| [publishError](#publisherror)      | `boolean`  | Optional     |

\* Set exactly one of [subscribe, read, and write](#subscribe-read-write).

### protocol

The protocol of the endpoint, which is the protocol of the connection that the endpoint uses. It decides which properties [subscribe, read, or write](#subscribe-read-write) take.

* **Required**
* Type: `enum`

The value **must** be one of the following:

* `Ads`
* `Bacnet`
* `EthernetIp`
* `File`
* `Focas`
* `Heidenhain`
* `Http`
* `Influxdb`
* `Influxdb3`
* `Kafka`
* `Modbus`
* `Mqtt`
* `Mssql`
* `Opcda`
* `Opcua`
* `Openprotocol`
* `S7`
* `S7plus`
* `Shdr`
* `Sinumerik`
* `Sopas`
* `Sql`
* `Systemstate`
* `Werma`

### connection

The [Cybus::Connection](https://docs.cybus.io/data-flows/service-commissioning-files/resources/cybus-connection.md) that the endpoint uses, usually written as `!ref <connection resource ID>`.

* **Required**
* Type: `string`

### subscribe / read / write

The operation of the endpoint and the address of the data point.

* **Required**, exactly one of the three
* Type: `object`

The operations work as follows:

* `subscribe` receives the values continuously. See [Polling Interval and Subscribe](#polling-interval-and-subscribe).
* `read` reads the value on request. See [Operation Results](#operation-results).
* `write` writes the messages that arrive on `<topic>/set`.

The properties inside the object depend on the protocol. They belong to `subscribe`, `read`, or `write`, one level below the endpoint properties:

{% code lineNumbers="true" %}

```yaml
temperature:
  type: Cybus::Endpoint
  properties:
    protocol: Modbus # endpoint property
    connection: !ref modbusConnection # endpoint property
    subscribe:
      fc: 3 # Modbus property
      address: 1 # Modbus property
      length: 2 # Modbus property
```

{% endcode %}

{% hint style="warning" %}
Put the protocol properties below `subscribe`, `read`, or `write`, not directly below `properties`. The two levels are easy to mix up.
{% endhint %}

The following pages list the properties of each protocol:

* [`Ads`](https://docs.cybus.io/connectors/shop-floor-connectors/ads/adsendpoint.md)
* [`Bacnet`](https://docs.cybus.io/connectors/shop-floor-connectors/bacnet/bacnetendpoint.md)
* [`EthernetIp`](https://docs.cybus.io/connectors/shop-floor-connectors/ethernet-ip/ethernetipendpoint.md)
* [`File`](https://docs.cybus.io/connectors/shop-floor-connectors/file/fileendpoint.md)
* [`Focas`](https://docs.cybus.io/connectors/shop-floor-connectors/focas/focasendpoint.md)
* [`Heidenhain`](https://docs.cybus.io/connectors/shop-floor-connectors/heidenhain-dnc/heidenhainendpoint.md)
* [`Http`](https://docs.cybus.io/connectors/enterprise-connectors/http-rest/httpendpoint.md)
* [`Influxdb`](https://docs.cybus.io/connectors/enterprise-connectors/influxdb/influxdbendpoint.md)
* [`Influxdb3`](https://docs.cybus.io/connectors/enterprise-connectors/influxdb/influxdb3endpoint.md)
* [`Kafka`](https://docs.cybus.io/connectors/enterprise-connectors/kafka/kafkaendpoint.md)
* [`Modbus`](https://docs.cybus.io/connectors/shop-floor-connectors/modbus-tcp/modbusendpoint.md)
* [`Mqtt`](https://docs.cybus.io/connectors/enterprise-connectors/mqtt/mqttendpoint.md)
* [`Mssql`](https://docs.cybus.io/connectors/enterprise-connectors/mssql/mssqlendpoint.md)
* [`Opcda`](https://docs.cybus.io/connectors/shop-floor-connectors/opc-da/opcdaendpoint.md)
* [`Opcua`](https://docs.cybus.io/connectors/shop-floor-connectors/opc-ua/opc-ua-client/opcuaendpoint.md)
* [`Openprotocol`](https://docs.cybus.io/connectors/shop-floor-connectors/open-protocol/openprotocolendpoint.md)
* [`S7`](https://docs.cybus.io/connectors/shop-floor-connectors/siemens-simatic-s7/s7endpoint.md)
* [`S7plus`](https://docs.cybus.io/connectors/shop-floor-connectors/siemens-simatic-s7-plus/s7plusendpoint.md)
* [`Shdr`](https://docs.cybus.io/connectors/shop-floor-connectors/shdr/shdrendpoint.md)
* [`Sinumerik`](https://docs.cybus.io/connectors/shop-floor-connectors/sinumerik/sinumerikendpoint.md)
* [`Sopas`](https://docs.cybus.io/connectors/shop-floor-connectors/sopas/sopasendpoint.md)
* [`Sql`](https://docs.cybus.io/connectors/enterprise-connectors/sql/sqlendpoint.md)
* [`Systemstate`](https://docs.cybus.io/connectors/enterprise-connectors/systemstate/systemstateendpoint.md)
* [`Werma`](https://docs.cybus.io/connectors/shop-floor-connectors/werma-win-ethernet/wermaendpoint.md)

### rules

[Rule Engine](https://docs.cybus.io/data-flows/rule-engine.md) rules that transform the raw data from the protocol before Connectware publishes it on the topic. The [split](https://docs.cybus.io/data-flows/rule-engine/data-processing-rules.md#split) rule is available only in mappings.

{% hint style="warning" %}
Endpoint rules change the data at its source. Every later processing step and every subscriber of the topic receives the transformed data.
{% endhint %}

* **Optional**
* Type: `array` of rules. See [Data Processing Rules](https://docs.cybus.io/data-flows/rule-engine/data-processing-rules.md).

### qos

The MQTT Quality of Service (QoS) level for messages from the endpoint to the internal MQTT broker.

With a QoS of `1` or `2`, the endpoint buffers incoming data locally while it cannot reach the broker, and publishes the data once the broker is reachable again. This covers short outages of the broker and, on an agent, interruptions of the connection to Connectware. The subscription to the machine stays active meanwhile.

* **Optional**
* Type: `integer`, one of `0`, `1`, `2`
* Default: `0`

{% hint style="warning" %}
Use QoS `0` or `1` for endpoints. QoS `2` is rarely useful for industrial data.
{% endhint %}

### retain

Whether the internal MQTT broker keeps the last message of the endpoint as a retained message.

On an agent, `true` keeps the last value on the topic while the agent is disconnected. Whether that helps depends on your application.

* **Optional**
* Type: `boolean`
* Default: `false`

### targetState

The state of the endpoint after the service starts.

* **Optional**
* Type: `enum`, one of `enabled`, `disabled`
* Default: `enabled`

### topic

The topic of the endpoint, below the topic prefix of the service.

{% hint style="warning" %}
Connectware puts the topic prefix of the service, [Cybus::MqttRoot](https://docs.cybus.io/data-flows/service-commissioning-files/parameters.md#cybus-mqttroot), in front of this topic. With the default prefix, the full topic is `services/<serviceId>/<topic>`, where `<serviceId>` is the service ID of the current service.
{% endhint %}

For other topic structures, see [MQTT Topic Prefix](https://docs.cybus.io/data-flows/service-commissioning-files/parameters.md#mqtt-topic-prefix).

An endpoint with its own topic saves the extra hop through a mapping, which improves performance. You can still map the topic with a [Cybus::Mapping](https://docs.cybus.io/data-flows/service-commissioning-files/resources/cybus-mapping.md).

* **Optional**
* Type: `string`, without `#` or `+`

### asset

A reference to a data property of a [Cybus::Asset](https://docs.cybus.io/data-flows/service-commissioning-files/resources/cybus-asset.md) in the form `<asset>.<property>`, for example `pump01.temperature`. Connectware replaces the reference with the topic of that property when you install the service, for example `factory/hall1/pump01/temperature`. This topic is used as is and is not prefixed with `Cybus::MqttRoot`.

Do not set `topic` at the same time. The asset must be declared in this service commissioning file or in an installed service, and it must be mounted. For the cases that fail the installation, see [Topics of an Asset](https://docs.cybus.io/data-flows/service-commissioning-files/resources/cybus-asset.md#topics-of-an-asset).

* **Optional**
* Type: `string`

### agentName

Connectware ignores this property. An endpoint runs where its connection runs, either in Connectware or on the agent of the connection.

### buffering

Buffers the messages of a `write` endpoint while the endpoint cannot write them to the device, so that no message gets lost. Buffering is off by default.

* **Optional**
* Type: `object`

The endpoint starts buffering all incoming values when the connection to the device drops. Buffering starts once the endpoint has connected to the device for the first time. For Kafka, the endpoint also buffers a write that fails temporarily while the connection stays up. For other protocols, a write that fails while the connection is up is not buffered.

Once the connection is back, the endpoint writes the buffered messages to the device. This is called flushing. If the connection drops again during a flush, the endpoint buffers new messages too and continues the flush after the next reconnect.

{% hint style="info" %}
The buffer belongs to the endpoint. If you disable the endpoint or its service, or a service update replaces or removes the endpoint, Connectware discards any messages that are still in its buffer at that moment. It does not write them to the device.
{% endhint %}

To turn buffering on, set `enabled: true`. Set the other properties to the behavior that your application expects and to what your device can handle:

| Property        | Type      | Default           | Description                                                                                             |
| --------------- | --------- | ----------------- | ------------------------------------------------------------------------------------------------------- |
| `enabled`       | `boolean` | `false`           | Turns buffering on.                                                                                     |
| `keepOrder`     | `boolean` | `true`            | Writes new messages only after all buffered messages.                                                   |
| `burstInterval` | `number`  | `100`             | Milliseconds between two bursts during a flush.                                                         |
| `burstSize`     | `number`  | `1`               | Number of messages per burst during a flush.                                                            |
| `bufferMaxSize` | `number`  | `100000`          | Maximum number of buffered messages. When the buffer is full, the endpoint deletes the oldest messages. |
| `bufferMaxAge`  | `number`  | `86400` (one day) | Seconds that a message stays in the buffer. The endpoint discards older messages.                       |

{% hint style="warning" %}
Balance these values against what your device can handle. For example, a large `bufferMaxSize` with a long `burstInterval` and a small `burstSize` makes a flush slow, so buffered messages can reach `bufferMaxAge` and expire.
{% endhint %}

With `keepOrder: true`, the endpoint holds back new messages until it has written all buffered messages. Suppose the buffer holds `1`, `2`, `3`, and `4`, and `5` and `6` arrive during the flush. The device receives `1` to `6` in this order.

With `keepOrder: false`, the order of new messages is unspecified, and they can mix with the buffered ones, for example `1`, `5`, `2`, `3`, `6`, `4`.

### inputBuffering

Gives the endpoint its own input queue. It holds the messages that arrive faster than the endpoint can process or publish them. Turn it on for endpoints with high data rates.

Input buffering is off by default, and the endpoint uses a queue that it shares with other resources. This works as long as Connectware processes messages as fast as they arrive. If processing or forwarding is slow, the queue grows until Connectware can run out of memory.

* **Optional**
* Type: `object`

With input buffering on, the endpoint processes 2 messages at a time and queues up to 5000 messages. If messages arrive too fast for a longer time, the queue fills up. The endpoint then discards new messages, so that it does not run out of memory. Resources are finite, so this cannot be avoided entirely.

The `inputBuffering` object takes the following properties. Only `enabled` takes effect:

| Property                  | Type      | Default | Description                                                        |
| ------------------------- | --------- | ------- | ------------------------------------------------------------------ |
| `enabled`                 | `boolean` | `false` | Turns input buffering on.                                          |
| `maxInputBufferSize`      | `integer` | `5000`  | Has no effect. The endpoint always queues up to 5000 messages.     |
| `maxConcurrentMessages`   | `integer` | `2`     | Has no effect. The endpoint always processes 2 messages at a time. |
| `waitingTimeOnEmptyQueue` | `integer` | `10`    | Has no effect.                                                     |

### publishError

Whether Connectware publishes a failed `read` or `write` operation on the `/res` topic as an `error` object with `message` and `code`. Set it to `true` when you use the endpoint in a [FlowSync](https://docs.cybus.io/data-flows/flowsync.md) flow.

* **Optional**
* Type: `boolean`, must be one of `true`, `false`
* Default: `false`

`publishError` has an effect on HTTP/REST endpoints, on ADS reads, and on OPC UA writes and method calls:

| Operation                       | `publishError: false`                                           | `publishError: true`                        |
| ------------------------------- | --------------------------------------------------------------- | ------------------------------------------- |
| HTTP/REST `read`                | The result is an empty message.                                 | The result contains an `error` object.      |
| HTTP/REST `write`               | The result contains `error` as a string with the message.       | The result contains an `error` object.      |
| ADS `read`                      | The result is an empty message.                                 | The result contains an `error` object.      |
| OPC UA `write` and method calls | The result contains the status code in `result` and no `error`. | The result also contains an `error` object. |

An OPC UA [batch endpoint](https://docs.cybus.io/connectors/shop-floor-connectors/opc-ua/opc-ua-client.md#batch-reading-and-writing) ignores `publishError`. It includes the `error` object when it rejects a message or aborts a batch.

The following result of an HTTP/REST `read` endpoint contains an `error` object:

```json
{
  "timestamp": 1629351968526,
  "id": "read-1",
  "error": {
    "message": "GET request on /foo failed with status: 404 - Not Found",
    "code": 404
  }
}
```

For the complete result formats, see [HTTP/REST](https://docs.cybus.io/connectors/enterprise-connectors/http-rest.md#read-results) and [OPC UA](https://docs.cybus.io/connectors/shop-floor-connectors/opc-ua/opc-ua-client.md#output-format-on-writing).

## Polling Interval and Subscribe

Use `subscribe` to receive the values of a data point continuously. Some protocols, such as OPC UA, support subscriptions, so the device sends new values on its own. For other protocols, Connectware polls the data point.

The [endpoint properties of each protocol](#subscribe-read-write) show which options it offers. If a protocol offers a choice, you set the behavior with the properties in `subscribe`.

To control polling, set one of the following properties in `subscribe`:

* `interval`: The time in milliseconds between the starts of two polls. A single poll can come a little earlier or later, depending on the protocol and the device. With an interval of 1000 milliseconds, the time between two polls is typically 950 to 1050 milliseconds. If a read takes longer than the interval, the next poll starts as soon as the read finishes, so fewer polls happen.
* `cronExpression`: A schedule in [cron syntax](https://github.com/node-cron/node-cron), for example `0 * * * *` for every full hour, such as 00:00, 01:00, and 02:00. The exact time of each result can vary, but Connectware polls once for every match. An hourly expression gives 24 results per day.

If you set both, `cronExpression` takes precedence. If you set neither, Connectware uses the default `interval` of the protocol.

## Operation Results

Endpoints of type `read` and `write` publish the results of their operations on an additional MQTT topic with the suffix `/res`:

* A `read` endpoint with the topic `<topic>` listens for requests on `<topic>/req` and publishes the result on `<topic>/res`.
* A `write` endpoint with the topic `<topic>` listens for messages on `<topic>/set` and publishes the result on `<topic>/res`.

To match a result to your request, add an `id` to the request. Whether the result contains this `id` depends on the protocol. SQL reads accept an `id` only in one case. See [Result Format per Protocol](#result-format-per-protocol).

{% code lineNumbers="true" %}

```json
{ "id": "29194" }
```

{% endcode %}

If the endpoint has [rules](#rules), Connectware applies them to the result before publishing it.

### Result Format per Protocol

Each protocol defines the format of its results. The following table lists the properties of a successful result. A result contains `id` only where its cell lists it, and then only if your request contains one.

| Protocol                                                                                                                  | `read` result                                                                                                                                         | `write` result                                                                   |
| ------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| [ADS](https://docs.cybus.io/connectors/shop-floor-connectors/ads.md)                                                      | `timestamp`, `value`, `id`                                                                                                                            | `timestamp`, `value` (`true`), `id`                                              |
| [BACnet](https://docs.cybus.io/connectors/shop-floor-connectors/bacnet.md)                                                | `value`, `timestamp`, `id`                                                                                                                            | Empty message                                                                    |
| [EtherNet/IP](https://docs.cybus.io/connectors/shop-floor-connectors/ethernet-ip.md)                                      | `id`, `value`, `timestamp`                                                                                                                            | `id`, `timestamp`                                                                |
| [FOCAS](https://docs.cybus.io/connectors/shop-floor-connectors/focas.md)                                                  | `id`, `timestamp`, `value`                                                                                                                            | Not supported                                                                    |
| [Heidenhain DNC](https://docs.cybus.io/connectors/shop-floor-connectors/heidenhain-dnc.md)                                | `timestamp`, `result`, `id` (`null` if your request has none)                                                                                         | Same as `read`                                                                   |
| [HTTP/REST](https://docs.cybus.io/connectors/enterprise-connectors/http-rest.md#read-results)                             | `timestamp`, `id`, `value`                                                                                                                            | `timestamp`, `id`, `value`                                                       |
| [InfluxDB and InfluxDB 3](https://docs.cybus.io/connectors/enterprise-connectors/influxdb.md)                             | The query result as an array of rows                                                                                                                  | `value` (`true`), `timestamp`                                                    |
| [Kafka](https://docs.cybus.io/connectors/enterprise-connectors/kafka.md)                                                  | Not supported                                                                                                                                         | `id` (`null` if your request has none), `timestamp`, `result`                    |
| [Modbus/TCP](https://docs.cybus.io/connectors/shop-floor-connectors/modbus-tcp.md)                                        | `timestamp`, `value`. Without `dataType`, the raw bytes.                                                                                              | The Modbus response                                                              |
| [MQTT](https://docs.cybus.io/connectors/enterprise-connectors/mqtt.md)                                                    | Not supported                                                                                                                                         | Empty message                                                                    |
| [MSSQL](https://docs.cybus.io/connectors/enterprise-connectors/mssql.md)                                                  | `timestamp`, `value`                                                                                                                                  | `id`, `timestamp`, `value` (`true`)                                              |
| [Open Protocol](https://docs.cybus.io/connectors/shop-floor-connectors/open-protocol.md#correlating-requests-and-results) | The reply MID. For a request with `id` and `value`, `id` and `result`.                                                                                | The acknowledgement MID. For a request with `id` and `value`, `id` and `result`. |
| [OPC DA](https://docs.cybus.io/connectors/shop-floor-connectors/opc-da.md)                                                | `timestamp`, `value`                                                                                                                                  | Empty message                                                                    |
| [OPC UA](https://docs.cybus.io/connectors/shop-floor-connectors/opc-ua/opc-ua-client.md#output-format-on-reading)         | The OPC UA data value. For a [batch](https://docs.cybus.io/connectors/shop-floor-connectors/opc-ua/opc-ua-client.md#reading-a-batch), `values`, `id`. | `id`, `timestamp`, `result`                                                      |
| [Siemens SIMATIC S7](https://docs.cybus.io/connectors/shop-floor-connectors/siemens-simatic-s7.md)                        | Not supported                                                                                                                                         | `id`, `timestamp`, `result` (`true`)                                             |
| [Siemens SIMATIC S7+](https://docs.cybus.io/connectors/shop-floor-connectors/siemens-simatic-s7-plus.md)                  | `timestamp`, `value`, `id`                                                                                                                            | `timestamp`, `result` (`true`)                                                   |
| [Shdr](https://docs.cybus.io/connectors/shop-floor-connectors/shdr.md)                                                    | Not supported                                                                                                                                         | Not supported                                                                    |
| [SINUMERIK](https://docs.cybus.io/connectors/shop-floor-connectors/sinumerik.md)                                          | `id`, `timestamp`, `result`                                                                                                                           | Empty message                                                                    |
| [SOPAS](https://docs.cybus.io/connectors/shop-floor-connectors/sopas.md)                                                  | The SOPAS telegram                                                                                                                                    | Empty message                                                                    |
| [SQL](https://docs.cybus.io/connectors/enterprise-connectors/sql.md)                                                      | `timestamp`, `value`, and `id` if the query has an `$id` placeholder                                                                                  | `id`, `timestamp`, `value` (`true`)                                              |
| [Systemstate](https://docs.cybus.io/connectors/enterprise-connectors/systemstate.md)                                      | `state`, `resourceId`, `timestamp`                                                                                                                    | Not supported                                                                    |
| [Werma WIN Ethernet](https://docs.cybus.io/connectors/shop-floor-connectors/werma-win-ethernet.md)                        | Not supported                                                                                                                                         | Not supported                                                                    |

An SQL `read` request can contain only the values for the placeholders of the query. Add an `id` only if the query uses an `$id` placeholder, otherwise the read fails.

### Failed Operations

What Connectware publishes when an operation fails depends on the protocol:

* An empty message, that is, an MQTT message without payload. Protocols that answer a successful write with an empty message answer a failed write the same way.
* A result with an `error` property. `error` is a message string or an object with `message` and `code`. For HTTP/REST endpoints, ADS reads, and OPC UA writes and method calls, the [publishError](#publisherror) property controls the format. OPC UA batch endpoints and Open Protocol endpoints include the `error` object regardless of `publishError`.
* For OPC UA, a result with a Bad status code. See [OPC UA](https://docs.cybus.io/connectors/shop-floor-connectors/opc-ua/opc-ua-client.md#output-format-on-writing).

Connectware processes requests on `/req` and `/set` while the connection of the endpoint is up. A `write` endpoint with [buffering](#buffering) also accepts messages while the connection is down and publishes the results once it writes the buffered messages. Use a timeout in your application when it waits for a result.

## Examples

### BACnet

The following endpoint polls the present value of the BACnet analog input with the object instance `2796204` every second:

{% code lineNumbers="true" %}

```yaml
bacnetSubscribe:
  type: Cybus::Endpoint
  properties:
    protocol: Bacnet
    connection: !ref bacnetConnection
    subscribe:
      objectType: analog-input
      objectInstance: 2796204
      property: present-value
      interval: 1000
```

{% endcode %}

### OPC UA

The following endpoint subscribes to the node `i=2258`, which holds the current time of the OPC UA server:

{% code lineNumbers="true" %}

```yaml
opcuaSubscribeToCurrentServerTime:
  type: Cybus::Endpoint
  properties:
    protocol: Opcua
    connection: !ref opcuaConnection
    subscribe:
      nodeId: i=2258
```

{% endcode %}

### MQTT with Write Buffering Enabled

The following `write` endpoint buffers up to 20,000 messages while the connection is down. Once the connection is back, it writes 100 messages every 10 milliseconds. New messages wait until the endpoint has written all buffered messages.

{% code lineNumbers="true" %}

```yaml
writeEndpoint:
  type: Cybus::Endpoint
  properties:
    protocol: Mqtt
    connection: !ref mqttConnection
    buffering:
      enabled: true
      keepOrder: true
      burstInterval: 10
      burstSize: 100
      bufferMaxSize: 20000
      bufferMaxAge: 5000
    write:
      topic: test/write
```

{% endcode %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.cybus.io/data-flows/service-commissioning-files/resources/cybus-endpoint.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
