ksqldb REST API push query - reconnect to last consumed offset + 1

Viewed 82

Is it possible to reconnect to the same push query after connection lost? There is a queryId for terminating a query. Can it be also used for reconnections via ksqldb REST API?

The client should receive all records from the beginning and also the missed ones during connection lost. In case that it stopped at offset 5, it should receive also the new messages after offset 5, but without replaying the whole topic from the beginning again. The ideal would be exactly once processing for all messages (records).

"POST" "http://<ksqldb-host-name>:8088/query-stream"

{
  "sql": "SELECT * FROM Movies EMIT CHANGES;",
  "properties":{"auto.offset.reset":"earliest"}
}

Header response with queryID:

{"queryId":"f91157c7-cd12-407e-a173-5a4cbc398259","columnNames":["TITLE","ID","RELEASE_YEAR"],"columnTypes":["STRING","INTEGER","INTEGER"]}
0 Answers
Related