featzhang opened a new pull request, #33:
URL: https://github.com/apache/flink-connector-http/pull/33
## What is the purpose of the change
This PR adds configurable retry support for HTTP Sink requests. When an HTTP
Sink request fails due to a network error (`IOException`), the connector will
automatically retry the request up to a configurable number of times using an
exponential backoff strategy.
## Brief change log
- Add `SINK_HTTP_RETRY_TIMES` constant to `HttpConnectorConfigConstants`
- Add `RETRY_TIMES` `ConfigOption` (default: `3`) to
`HttpDynamicSinkConnectorOptions`
- Register `RETRY_TIMES` as an optional option in
`HttpDynamicTableSinkFactory`
- Pass retry configuration via `Properties` in `HttpDynamicSink`
- Implement `submitWithRetry()` method in `HttpSinkWriter` with exponential
backoff (1s, 2s, 4s, ...)
- Add unit test `testRetryOnError` to verify retry behavior
- Update documentation (English and Chinese) with new
`http.sink.retry.times` option
## Verifying this change
This change adds tests and can be verified as follows:
- `HttpSinkWriterTest#testRetryOnError`: Verifies that the writer retries
the configured number of times on `IOException`
- `HttpSinkWriterTest#testErrorMetric`: Verifies that error metrics are
recorded correctly when retries are exhausted
## Does this pull request potentially affect one of the following areas
- Dependencies (does it add or upgrade a dependency): No
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: No
- Build infrastructure: No
- HTTP Sink behavior: **Yes** — requests failing with `IOException` will now
be retried (configurable, default 3 times)
## Documentation
- Does this pull request introduce a new feature? **Yes**
- If yes, how is the feature documented? **Documented in connector table
options (`.md` files)**
## Usage Example
```sql
CREATE TABLE http_sink (
id BIGINT,
name STRING
) WITH (
'connector' = 'http-sink',
'url' = 'http://localhost:8080/api',
'format' = 'json',
'http.sink.retry.times' = '5' -- retry up to 5 times, set to 0 to disable
);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]