Skip to content
Storage

Create and configure a data stream

Create a data stream in the app, set its table, import conditions and payload test, choose a delivery guarantee, and send events from Apache Kafka.

Work through these tasks in order for a new HTTP stream, or jump to the one you need. For what Data Streams are, see the overview; for column types, templates and the Stream API, see the reference.

Goal: a data stream that your systems can send events to.

  1. Navigate to Storage > Data Streams and click Create Data Stream.
  2. Choose a source type — either HTTP (generic webhook) or OpenTelemetry (OTLP).
  3. Name the data stream, e.g., “my-first-data-stream.” The name of the table will be filled automatically based on the stream name, but you can change it if needed.
  4. Once the stream is created, you can add a description for better orientation within the project.

Result: The stream is created. Configure an HTTP stream as described below. For an OTLP stream, continue with Send OpenTelemetry (OTLP) data to Keboola.

Goal: the stream maps events to the columns you want, imports them on your conditions, and receives its first events.

  1. Copy the Data Stream URL. For every data stream, a unique “Data Stream URL” is generated. You can use it in your application to send events. This URL cannot be changed.

  2. In Table settings, set up the destination table. You can:

    • Change the name of the stream.
    • Add a column or define your own structure using the PATH or JSONNET template. Learn more
    • Edit column names (available only if you create a new table within the stream).
    • Delete a column (available only if you create a new table within the stream).

    Data streams do not support primary keys: every incoming event is appended to the table. To get unique rows, deduplicate downstream as described in No primary keys.

  3. In Import conditions, set the conditions for importing data: the interval, the size of the imported data, or the number of imported records. Whichever condition is met first triggers an import into the destination table. Learn more

  4. In Payload test, simulate your payload and test it instantly with a table preview to see how the data will be imported before deploying it into production. The same check is available over the API through the payload test endpoint.

  5. Send events from your application to the Data Stream URL. Sample codes for integration has a few examples of how to send data to a stream using Python, Javascript, and Bash. For a sender set up from start to finish, see the tutorial’s GitHub webhook step.

  6. Open Table statistics. This dashboard shows the status of data waiting for import vs. imported data.

    Screenshot - Data Streams Table Statistics

Result: Table statistics shows the events you sent as waiting for import, and as imported once the first import condition is met.

Goal: the stream delivers each record at most once or at least once, whichever your use case needs.

Depending on your use case, you may require different delivery guarantees for your stream. Follow the guidelines below to ensure the desired outcome. Both rely on the settings endpoints.

Both settings are changed with one request. For example, to turn off the wait for a source (all its sinks):

Terminal window
curl --request PATCH "https://stream.keboola.com/v1/branches/default/sources/<sourceId>/settings" \
--header "Content-Type: application/json" \
--header "X-StorageApi-Token: <master token of an admin user>" \
--data '{"settings": [{"key": "storage.level.local.encoding.sync.wait", "value": false}]}'

The call returns 202 Accepted with a task; poll the task’s url until it finishes. To change one sink only, send the same body to /v1/branches/default/sources/<sourceId>/sinks/<sinkId>/settings. Send "value": null to return to the default (true). Replace stream.keboola.com with your stack’s Stream API host.

  1. To ensure that no record is delivered twice, make sure the client doesn’t retry when sending the records.
  2. In this case, it’s beneficial to use the settings endpoints to set "storage.level.local.encoding.sync.wait" to false to increase throughput.
  1. To ensure that every record is delivered at least once, implement retries in the client when sending the records.
  2. Use the settings endpoints to confirm that "storage.level.local.encoding.sync.wait" is set to true (default behavior). Note that this setting guarantees that the record is written to the local disk.

Result: The client and the stream’s settings match the guarantee you chose.

Goal: a data stream ingests the records from your Kafka topics.

To connect Keboola with Apache Kafka® (opens in a new tab) and ingest data from Kafka topics via data streams, use the Kafka Connect HTTP Sink Connector to establish a communication channel between Kafka and Keboola. The connector acts as a bridge between Kafka and Keboola’s Data Stream HTTP API.

  1. Create an HTTP data stream and copy its Data Stream URL. The target Keboola API URL corresponds to the data stream created in Keboola.
  2. Configure the Kafka Connect HTTP Sink Connector. This integration relies on the connector, which requires configuration on the Kafka side:
    • Send the data to the Data Stream URL as a POST request. Only POST HTTP methods are supported for data ingestion.
    • Send one Kafka record per request: leave batching off, or set the batch size (batch.max.size) to 1. A data stream stores each request body as one record, so a batch of several Kafka records lands in the table as a single row.

Result: The connector continuously reads data records from one or more Kafka topics and sends the data as a POST request in JSON format to Keboola’s Data Stream API URL. Data records from Kafka topics are transformed into strings before being sent to Keboola.

Next: Send OpenTelemetry (OTLP) data to Keboola →

Ask Kai

Hi, I'm Kai — Keboola's AI assistant for the docs. Ask me anything and I'll answer from the documentation and cite the pages I use.

Kai is an AI and can make mistakes. Check the sources it links.