@@ -109,8 +109,10 @@ public class HTTPAppender extends AbstractAppender {
109
109
private final ErrorReceiverProxy errorReceiverProxy ;
110
110
111
111
private String forwardUrl ;
112
+ private Long timeout ;
112
113
private Long connectionTimeout ;
113
- private Long readTimeout ;
114
+ private Long connectionRequestTimeout ;
115
+ private Long timeToLive ;
114
116
private Long forwardChunkSize ;
115
117
private Set <String > metaKeySet = getMetaKeySet (META_KEYS_DEFAULT );
116
118
@@ -174,11 +176,17 @@ protected Output createOutput() {
174
176
final HttpClientConfiguration .Builder builder = HttpClientConfiguration .builder ();
175
177
builder .tlsConfiguration (httpTlsConfiguration );
176
178
179
+ if (timeout != null ) {
180
+ builder .timeout (StroomDuration .ofMillis (timeout .intValue ()));
181
+ }
177
182
if (connectionTimeout != null ) {
178
183
builder .connectionTimeout (StroomDuration .ofMillis (connectionTimeout .intValue ()));
179
184
}
180
- if (readTimeout != null ) {
181
- builder .connectionRequestTimeout (StroomDuration .ofMillis (readTimeout .intValue ()));
185
+ if (connectionRequestTimeout != null ) {
186
+ builder .connectionRequestTimeout (StroomDuration .ofMillis (connectionRequestTimeout .intValue ()));
187
+ }
188
+ if (timeToLive != null ) {
189
+ builder .timeToLive (StroomDuration .ofMillis (timeToLive .intValue ()));
182
190
}
183
191
184
192
final HttpClientConfiguration httpClientConfiguration = builder .build ();
@@ -501,14 +509,24 @@ private void addRequestProperty(final HttpUriRequestBase request,
501
509
}
502
510
503
511
private void logConnectionToDebug () {
504
- LOGGER .debug (() -> LogUtil .message ("About to connect to {} with requestMethod: {}, contentType: {}, " +
505
- "readTimeout: {}, connectionTimeout: {}, useCompression: {}, " +
506
- "compressionMethod: {}, forwardChunkSize: {}, request properties:\n {}" ,
512
+ LOGGER .debug (() -> LogUtil .message ("About to connect to {} with " +
513
+ "requestMethod: {}, " +
514
+ "contentType: {}, " +
515
+ "timeout: {}, " +
516
+ "connectionTimeout: {}, " +
517
+ "connectionRequestTimeout: {}, " +
518
+ "timeToLive: {}, " +
519
+ "useCompression: {}, " +
520
+ "compressionMethod: {}, " +
521
+ "forwardChunkSize: {}, " +
522
+ "request properties:\n {}" ,
507
523
forwardUrl ,
508
524
requestMethod ,
509
525
contentType ,
510
- readTimeout ,
526
+ timeout ,
511
527
connectionTimeout ,
528
+ connectionRequestTimeout ,
529
+ timeToLive ,
512
530
outputStreamSupport .isUseCompression (),
513
531
outputStreamSupport .getCompressionMethod (),
514
532
forwardChunkSize ,
@@ -628,39 +646,82 @@ public void setForwardUrl(final String forwardUrl) {
628
646
this .forwardUrl = forwardUrl ;
629
647
}
630
648
631
- @ PipelineProperty (description = "How long to wait before we abort sending data due to connection timeout. " +
649
+ @ PipelineProperty (description = "Determines the timeout until arrival of a response from the opposite endpoint. " +
650
+ "A timeout value of zero is interpreted as an infinite timeout. " +
651
+ "Default: 3 minutes. " +
632
652
"The timeout is specified as either milliseconds, e.g. '60000' or with a " +
633
653
"duration suffix, e.g. '500ms', '2s', '1m', etc." ,
634
654
displayPriority = 6 )
655
+ public void setTimeout (final String string ) {
656
+ timeout = null ;
657
+ if (NullSafe .isNonEmptyString (string )) {
658
+ timeout = ModelStringUtil .parseDurationString (string );
659
+ }
660
+ }
661
+
662
+ @ PipelineProperty (description = "Determines the timeout until a new connection is fully established. " +
663
+ "This may also include transport security negotiation exchanges such as SSL or " +
664
+ "TLS protocol negotiation. " +
665
+ "A timeout value of zero is interpreted as an infinite timeout. " +
666
+ "Default: 3 minutes. " +
667
+ "The timeout is specified as either milliseconds, e.g. '60000' or with a " +
668
+ "duration suffix, e.g. '500ms', '2s', '1m', etc." ,
669
+ displayPriority = 7 )
635
670
public void setConnectionTimeout (final String string ) {
636
671
connectionTimeout = null ;
637
672
if (NullSafe .isNonEmptyString (string )) {
638
673
connectionTimeout = ModelStringUtil .parseDurationString (string );
639
674
}
640
675
}
641
676
677
+ @ PipelineProperty (description = "Returns the connection lease request timeout used when requesting a connection " +
678
+ "from the connection manager. " +
679
+ "Default: 3 minutes. " +
680
+ "The timeout is specified as either milliseconds, e.g. '60000' or with a " +
681
+ "duration suffix, e.g. '500ms', '2s', '1m', etc." ,
682
+ displayPriority = 8 )
683
+ public void setConnectionRequestTimeout (final String string ) {
684
+ connectionRequestTimeout = null ;
685
+ if (NullSafe .isNonEmptyString (string )) {
686
+ connectionRequestTimeout = ModelStringUtil .parseDurationString (string );
687
+ }
688
+ }
689
+
642
690
@ PipelineProperty (description = "How long to wait for data to be available before closing the connection. " +
643
691
"The timeout is specified as either milliseconds, e.g. '60000' or with a " +
644
692
"duration suffix, e.g. '500ms', '2s', '1m', etc." ,
645
- displayPriority = 7 )
693
+ displayPriority = 8 )
694
+ @ Deprecated
646
695
public void setReadTimeout (final String string ) {
647
- readTimeout = null ;
696
+ if (string != null ) {
697
+ setConnectionRequestTimeout (string );
698
+ }
699
+ }
700
+
701
+ @ PipelineProperty (description = "The maximum time a pooled connection can stay idle (not leased to any thread) " +
702
+ "before it is shut down. " +
703
+ "Default: 1 hour. " +
704
+ "The timeout is specified as either milliseconds, e.g. '60000' or with a " +
705
+ "duration suffix, e.g. '500ms', '2s', '1m', etc." ,
706
+ displayPriority = 9 )
707
+ public void setTimeToLive (final String string ) {
708
+ timeToLive = null ;
648
709
if (NullSafe .isNonEmptyString (string )) {
649
- readTimeout = ModelStringUtil .parseDurationString (string );
710
+ timeToLive = ModelStringUtil .parseDurationString (string );
650
711
}
651
712
}
652
713
653
714
@ PipelineProperty (description = "Should data be sent in chunks and if so how big should the chunks be. " +
654
715
"Size is either specified in bytes e.g. '1024' or with a IEC unit suffix, " +
655
716
"e.g. '1K', '1M', '1G', etc." ,
656
- displayPriority = 8 )
717
+ displayPriority = 10 )
657
718
public void setForwardChunkSize (final String string ) {
658
719
this .forwardChunkSize = ModelStringUtil .parseIECByteSizeString (string );
659
720
}
660
721
661
722
@ PipelineProperty (description = "Should data be compressed when sending" ,
662
723
defaultValue = DEFAULT_USE_COMPRESSION_PROP_VALUE ,
663
- displayPriority = 9 )
724
+ displayPriority = 11 )
664
725
public void setUseCompression (final boolean useCompression ) {
665
726
outputStreamSupport .setUseCompression (useCompression );
666
727
}
@@ -672,7 +733,7 @@ public void setUseCompression(final boolean useCompression) {
672
733
"other destinations, but is only applicable for compression types " +
673
734
"'gz', 'zstd' or 'deflate'." ,
674
735
defaultValue = DEFAULT_USE_CONTENT_ENCODING_PROP_VALUE ,
675
- displayPriority = 10 )
736
+ displayPriority = 12 )
676
737
public void setUseContentEncodingHeader (final boolean useContentEncodingHeader ) {
677
738
this .useContentEncodingHeader = useContentEncodingHeader ;
678
739
}
@@ -681,7 +742,7 @@ public void setUseContentEncodingHeader(final boolean useContentEncodingHeader)
681
742
description = "Compression method to apply, if compression is enabled. Supported values: " +
682
743
CompressionUtil .SUPPORTED_COMPRESSORS + "." ,
683
744
defaultValue = DEFAULT_COMPRESSION_METHOD_PROP_VALUE ,
684
- displayPriority = 11 )
745
+ displayPriority = 13 )
685
746
public void setCompressionMethod (final String compressionMethod ) {
686
747
try {
687
748
outputStreamSupport .setCompressionMethod (compressionMethod );
@@ -695,7 +756,7 @@ public void setCompressionMethod(final String compressionMethod) {
695
756
description = "Specifies Which meta data keys will have their values logged in the send log. A Comma " +
696
757
"delimited string of keys." ,
697
758
defaultValue = META_KEYS_DEFAULT ,
698
- displayPriority = 12 )
759
+ displayPriority = 14 )
699
760
public void setLogMetaKeys (final String string ) {
700
761
metaKeySet = getMetaKeySet (string );
701
762
}
@@ -706,85 +767,85 @@ public void setLogMetaKeys(final String string) {
706
767
"Set this to false if you are explicitly setting key/trust store properties on " +
707
768
"this HttpAppender." ,
708
769
defaultValue = "true" ,
709
- displayPriority = 13 )
770
+ displayPriority = 15 )
710
771
@ Deprecated
711
772
public void setUseJvmSslConfig (final boolean useJvmSslConfig ) {
712
773
// this.useJvmSslConfig = useJvmSslConfig;
713
774
}
714
775
715
776
@ PipelineProperty (description = "The key store file path on the server" ,
716
- displayPriority = 14 )
777
+ displayPriority = 16 )
717
778
public void setKeyStorePath (final String keyStorePath ) {
718
779
sslConfigBuilder .withKeyStorePath (keyStorePath );
719
780
}
720
781
721
782
@ PipelineProperty (description = "The key store type. " +
722
783
"Valid values are ['JCEKS', 'JKS', 'DKS', 'PKCS11', 'PKCS12']." ,
723
784
defaultValue = "JKS" ,
724
- displayPriority = 15 )
785
+ displayPriority = 17 )
725
786
public void setKeyStoreType (final String keyStoreType ) {
726
787
sslConfigBuilder .withKeyStoreType (keyStoreType );
727
788
}
728
789
729
790
@ PipelineProperty (description = "The key store password" ,
730
- displayPriority = 16 )
791
+ displayPriority = 18 )
731
792
public void setKeyStorePassword (final String keyStorePassword ) {
732
793
sslConfigBuilder .withKeyStorePassword (keyStorePassword );
733
794
}
734
795
735
796
@ PipelineProperty (description = "The trust store file path on the server" ,
736
- displayPriority = 17 )
797
+ displayPriority = 19 )
737
798
public void setTrustStorePath (final String trustStorePath ) {
738
799
sslConfigBuilder .withTrustStorePath (trustStorePath );
739
800
}
740
801
741
802
@ PipelineProperty (description = "The trust store type " +
742
803
"Valid values are ['JCEKS', 'JKS', 'DKS', 'PKCS11', 'PKCS12']." ,
743
804
defaultValue = "JKS" ,
744
- displayPriority = 18 )
805
+ displayPriority = 20 )
745
806
public void setTrustStoreType (final String trustStoreType ) {
746
807
sslConfigBuilder .withTrustStoreType (trustStoreType );
747
808
}
748
809
749
810
@ PipelineProperty (description = "The trust store password" ,
750
- displayPriority = 19 )
811
+ displayPriority = 21 )
751
812
public void setTrustStorePassword (final String trustStorePassword ) {
752
813
sslConfigBuilder .withTrustStorePassword (trustStorePassword );
753
814
}
754
815
755
816
@ PipelineProperty (description = "Set this to true to verify that the destination host name matches against " +
756
817
"the host names in the certificate supplied by the destination server." ,
757
818
defaultValue = "true" ,
758
- displayPriority = 20 )
819
+ displayPriority = 22 )
759
820
public void setHostnameVerificationEnabled (final boolean hostnameVerificationEnabled ) {
760
821
sslConfigBuilder .withHostnameVerificationEnabled (hostnameVerificationEnabled );
761
822
}
762
823
763
824
@ PipelineProperty (description = "The SSL protocol to use" ,
764
825
defaultValue = "TLSv1.2" ,
765
- displayPriority = 21 )
826
+ displayPriority = 23 )
766
827
public void setSslProtocol (final String sslProtocol ) {
767
828
sslConfigBuilder .withSslProtocol (NullSafe .get (sslProtocol , String ::trim ));
768
829
}
769
830
770
831
@ PipelineProperty (description = "The HTTP request method. Valid values are " +
771
832
"GET, POST, HEAD, OPTIONS, PUT, DELETE and TRACE." ,
772
833
defaultValue = DEFAULT_REQUEST_METHOD_PROP_VALUE ,
773
- displayPriority = 22 )
834
+ displayPriority = 24 )
774
835
public void setRequestMethod (String requestMethod ) {
775
836
this .requestMethod = NullSafe .get (requestMethod , String ::trim , String ::toUpperCase );
776
837
}
777
838
778
839
@ PipelineProperty (description = "The content type" ,
779
840
defaultValue = "application/json" ,
780
- displayPriority = 23 )
841
+ displayPriority = 25 )
781
842
public void setContentType (String contentType ) {
782
843
this .contentType = contentType ;
783
844
}
784
845
785
846
@ PipelineProperty (description = "Provide stream metadata as HTTP headers" ,
786
847
defaultValue = "true" ,
787
- displayPriority = 24 )
848
+ displayPriority = 26 )
788
849
public void setHttpHeadersIncludeStreamMetaData (final boolean newValue ) {
789
850
this .httpHeadersIncludeStreamMetaData = newValue ;
790
851
}
@@ -795,7 +856,7 @@ public void setHttpHeadersIncludeStreamMetaData(final boolean newValue) {
795
856
"If httpHeadersStreamMetaDataAllowList contains keys, " +
796
857
"httpHeadersStreamMetaDataDenyList is ignored." ,
797
858
defaultValue = "" ,
798
- displayPriority = 25 )
859
+ displayPriority = 27 )
799
860
public void setHttpHeadersStreamMetaDataAllowList (final String newValue ) {
800
861
this .httpHeadersStreamMetaDataAllowList = newValue ;
801
862
}
@@ -806,25 +867,25 @@ public void setHttpHeadersStreamMetaDataAllowList(final String newValue) {
806
867
"If httpHeadersStreamMetaDataAllowList contains keys, " +
807
868
"httpHeadersStreamMetaDataDenyList is ignored." ,
808
869
defaultValue = "" ,
809
- displayPriority = 26 )
870
+ displayPriority = 28 )
810
871
public void setHttpHeadersStreamMetaDataDenyList (final String newValue ) {
811
872
this .httpHeadersStreamMetaDataDenyList = newValue ;
812
873
}
813
874
814
875
@ PipelineProperty (description = "Additional HTTP Header 1, format is 'HeaderName: HeaderValue'" ,
815
- displayPriority = 27 )
876
+ displayPriority = 29 )
816
877
public void setHttpHeadersUserDefinedHeader1 (final String headerText ) {
817
878
this .httpHeadersUserDefinedHeader1 = headerText ;
818
879
}
819
880
820
881
@ PipelineProperty (description = "Additional HTTP Header 2, format is 'HeaderName: HeaderValue'" ,
821
- displayPriority = 28 )
882
+ displayPriority = 30 )
822
883
public void setHttpHeadersUserDefinedHeader2 (final String headerText ) {
823
884
this .httpHeadersUserDefinedHeader2 = headerText ;
824
885
}
825
886
826
887
@ PipelineProperty (description = "Additional HTTP Header 3, format is 'HeaderName: HeaderValue'" ,
827
- displayPriority = 29 )
888
+ displayPriority = 31 )
828
889
public void setHttpHeadersUserDefinedHeader3 (final String headerText ) {
829
890
this .httpHeadersUserDefinedHeader3 = headerText ;
830
891
}
0 commit comments