featzhang created FLINK-39364:
---------------------------------
Summary: [CONNECTOR-HTTP] Add request timeout as typed
ConfigOption for HTTP lookup source and sink
Key: FLINK-39364
URL: https://issues.apache.org/jira/browse/FLINK-39364
Project: Flink
Issue Type: New Feature
Components: Connectors / HTTP
Reporter: featzhang
h2. Summary
{{http.source.lookup.request.timeout}} and {{http.sink.request.timeout}} were
consumed at runtime but never declared as typed {{ConfigOption}}
definitions, causing Flink's factory validation to reject them with an
"Unsupported options" error when specified in SQL DDL.
h2. Problem
Both timeout keys are defined as raw string constants in
{{HttpConnectorConfigConstants}} and read at runtime, but are absent from
{{optionalOptions()}}
in their respective factory classes. This means:
# Users configuring these options via SQL DDL {{WITH}} clause receive a
{{ValidationException}}
# There is no type safety, default value enforcement, or IDE auto-completion
# A TODO comment in {{HttpLookupTableSourceFactory}} acknowledges this gap:
{code:java}
SOURCE_LOOKUP_CONNECTION_TIMEOUT // TODO: add request timeout from properties
{code}
h2. Steps to Reproduce
{code:sql}
CREATE TABLE http_lookup (
id BIGINT,
name STRING
) WITH (
'connector' = 'http',
'url' = 'http://localhost/api',
'format' = 'json',
'lookup-method' = 'GET',
'http.source.lookup.request.timeout' = '60s'
);
{code}
*Result:*
{noformat}
org.apache.flink.table.api.ValidationException: Unsupported options found for
'http'.
Unsupported options:
http.source.lookup.request.timeout
{noformat}
h2. Fix
# Define {{ConfigOption<Duration>}} for both options with default value
{{30s}}:
** {{HttpLookupConnectorOptions.SOURCE_LOOKUP_REQUEST_TIMEOUT}}
** {{HttpDynamicSinkConnectorOptions.SINK_REQUEST_TIMEOUT}}
# Register both in {{optionalOptions()}} of their factory classes
# Update documentation to reflect the {{Duration}} type (e.g. {{'30s'}},
{{'1min'}})
h2. Related
* PR: https://github.com/apache/flink-connector-http/pull/31
--
This message was sent by Atlassian Jira
(v8.20.10#820010)