NIFI-11629 This closes #7327. Added Socket Write Timeout to InvokeHTTP

Signed-off-by: Joe Witt <joewitt@apache.org>
(cherry picked from commit ec525b0437f6369a7dca56b9818475385d0d03a6)
This commit is contained in:
exceptionfactory 2023-06-01 17:12:38 -05:00
parent 5450831547
commit 39b063f49e
No known key found for this signature in database
GPG Key ID: 29B6A52D2AAE8DBA

View File

@ -244,6 +244,15 @@ public class InvokeHTTP extends AbstractProcessor {
.addValidator(StandardValidators.TIME_PERIOD_VALIDATOR)
.build();
public static final PropertyDescriptor SOCKET_WRITE_TIMEOUT = new PropertyDescriptor.Builder()
.name("Socket Write Timeout")
.displayName("Socket Write Timeout")
.description("Maximum time to wait for write operations while sending requests from a socket connection to the HTTP URL.")
.required(true)
.defaultValue("15 secs")
.addValidator(StandardValidators.TIME_PERIOD_VALIDATOR)
.build();
public static final PropertyDescriptor SOCKET_IDLE_TIMEOUT = new PropertyDescriptor.Builder()
.name("idle-timeout")
.displayName("Socket Idle Timeout")
@ -560,6 +569,7 @@ public class InvokeHTTP extends AbstractProcessor {
SSL_CONTEXT_SERVICE,
SOCKET_CONNECT_TIMEOUT,
SOCKET_READ_TIMEOUT,
SOCKET_WRITE_TIMEOUT,
SOCKET_IDLE_TIMEOUT,
SOCKET_IDLE_CONNECTIONS,
PROXY_CONFIGURATION_SERVICE,
@ -833,6 +843,7 @@ public class InvokeHTTP extends AbstractProcessor {
okHttpClientBuilder.followRedirects(context.getProperty(RESPONSE_REDIRECTS_ENABLED).asBoolean());
okHttpClientBuilder.connectTimeout((context.getProperty(SOCKET_CONNECT_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue()), TimeUnit.MILLISECONDS);
okHttpClientBuilder.readTimeout(context.getProperty(SOCKET_READ_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue(), TimeUnit.MILLISECONDS);
okHttpClientBuilder.writeTimeout(context.getProperty(SOCKET_WRITE_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue(), TimeUnit.MILLISECONDS);
okHttpClientBuilder.connectionPool(
new ConnectionPool(
context.getProperty(SOCKET_IDLE_CONNECTIONS).asInteger(),