Skip to content

Commit be30924

Browse files
committed
contract clarification
1 parent d4f449f commit be30924

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

core/src/main/java/io/questdb/client/Sender.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@
102102
* <br>
103103
* Note: If the underlying error is permanent, retrying {@link #flush()} will fail again.
104104
* Use {@link #reset()} to discard the problematic data and continue with new data.
105+
* <br>
106+
* Note: WebSocket transport uses a terminal sender-level failure model after a
107+
* connection has been established. After a WebSocket send, ACK, or connection
108+
* failure, {@link #reset()} does not recover the sender; close it and create a
109+
* new one.
105110
*
106111
*/
107112
public interface Sender extends Closeable, ArraySender<Sender> {

core/src/main/java/io/questdb/client/cutlass/qwp/client/QwpWebSocketSender.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,17 @@
8585
* sender.flush();
8686
* }
8787
* </pre>
88+
* <p>
89+
* Failure handling: after this sender has established a WebSocket connection,
90+
* any WebSocket send failure, receive failure, ACK timeout, server error ACK,
91+
* invalid ACK, or server close is terminal for this sender instance. The first
92+
* such failure is retained and subsequent public operations rethrow the same
93+
* {@link LineSenderException}. {@link #reset()} only discards buffered row data;
94+
* it does not recover a terminal WebSocket failure. To resume sending after a
95+
* terminal WebSocket failure, close this sender and create a new instance.
96+
* <p>
97+
* Initial connection failures are not retained as terminal sender state; a later
98+
* operation may try to connect again.
8899
*/
89100
public class QwpWebSocketSender implements Sender {
90101

@@ -730,6 +741,20 @@ public QwpWebSocketSender floatColumn(CharSequence columnName, float value) {
730741
return this;
731742
}
732743

744+
/**
745+
* Flushes buffered rows and waits until the server acknowledges all submitted
746+
* WebSocket batches.
747+
* <p>
748+
* If a WebSocket send, receive, ACK timeout, server error ACK, invalid ACK,
749+
* or server close is observed after the connection has been established, the
750+
* sender enters a terminal failed state. The first failure is retained and
751+
* subsequent public operations rethrow the same {@link LineSenderException}.
752+
* Create a new sender to resume sending.
753+
*
754+
* @throws LineSenderException if the sender is closed, a row is still in
755+
* progress, connection setup fails, or a terminal
756+
* WebSocket failure is observed
757+
*/
733758
@Override
734759
public void flush() {
735760
checkNotClosed();

0 commit comments

Comments
 (0)