Skip to content

Commit

Permalink
Support offloading the request data to disk with VertxHttpClientHTTPC…
Browse files Browse the repository at this point in the history
…onduit fix #1628
  • Loading branch information
ppalaga committed Jan 19, 2025
1 parent f99c7a9 commit 34398af
Show file tree
Hide file tree
Showing 28 changed files with 2,130 additions and 114 deletions.
12 changes: 12 additions & 0 deletions docs/.asciidoctorconfig.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++
// + Initial AsciiDoc editor configuration file - V1.0 +
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// Did not find any configuration files, so creating this at project root level.
// If you do not like those files to be generated - you can turn it off inside Asciidoctor Editor preferences.
//
// You can define editor specific parts here.
// For example: with next line you could set imagesdir attribute to subfolder "images" relative to the folder where this config file is located.
// :imagesdir: {asciidoctorconfigdir}/images
//
// For more information please take a look at https://github.com/de-jcup/eclipse-asciidoctor-editor/wiki/Asciidoctor-configfiles
10 changes: 10 additions & 0 deletions docs/modules/ROOT/examples/client-server/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -191,5 +191,15 @@ quarkus.cxf.client.helloWithoutWsdlWithBlocking.client-endpoint-url = http://loc
quarkus.cxf.client.helloWithoutWsdlWithBlocking.service-interface = io.quarkiverse.cxf.deployment.test.HelloService


quarkus.cxf.retransmit-cache.threshold = 500K
quarkus.cxf.retransmit-cache.directory = ${qcxf.retransmitCacheDir}
quarkus.log.category."io.quarkiverse.cxf.vertx.http.client.BodyRecorder".level = DEBUG
quarkus.log.category."io.quarkiverse.cxf.vertx.http.client.TempStore".level = DEBUG

quarkus.cxf.client.retransmitCache.client-endpoint-url = http://localhost:${quarkus.http.test-port}/RedirectRest/retransmitCacheRedirect
quarkus.cxf.client.retransmitCache.service-interface = io.quarkiverse.cxf.it.redirect.retransmitcache.RetransmitCacheService
quarkus.cxf.client.retransmitCache.auto-redirect = true
#quarkus.cxf.client.retransmitCache.logging.enabled = true

quarkus.default-locale = en_US
quarkus.log.category."io.quarkiverse.cxf.vertx.http.client.VertxHttpClientHTTPConduit".level=DEBUG
121 changes: 121 additions & 0 deletions docs/modules/ROOT/pages/reference/extensions/quarkus-cxf.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,100 @@ respectively.
*Environment variable*: `+++QUARKUS_CXF_LOGGING_SENSITIVE_PROTOCOL_HEADER_NAMES+++` +
*Since Quarkus CXF*: 2.6.0

.<| [[quarkus-cxf_quarkus-cxf-retransmit-cache-threshold]]`link:#quarkus-cxf_quarkus-cxf-retransmit-cache-threshold[quarkus.cxf.retransmit-cache.threshold]`
.<| `MemorySize` link:#memory-size-note-anchor-quarkus-cxf[icon:question-circle[title=More information about the MemorySize format]]
.<| `128K`

3+a|If the request retransmission is active for the given client and if request body is larger than this threshold,
then the body is cached on disk instead of keeping it in memory.

In plain CXF, this is equivalent to setting the `bus.io.CachedOutputStream.Threshold` property on CXF Bus.

See also:

* `xref:reference/extensions/quarkus-cxf.adoc#quarkus-cxf_quarkus-cxf-client-client-name-auto-redirect[quarkus.cxf.client."client-name".auto-redirect]`

*Environment variable*: `+++QUARKUS_CXF_RETRANSMIT_CACHE_THRESHOLD+++` +
*Since Quarkus CXF*: 3.18.0

.<| [[quarkus-cxf_quarkus-cxf-retransmit-cache-max-size]]`link:#quarkus-cxf_quarkus-cxf-retransmit-cache-max-size[quarkus.cxf.retransmit-cache.max-size]`
.<| `MemorySize` link:#memory-size-note-anchor-quarkus-cxf[icon:question-circle[title=More information about the MemorySize format]]
.<|

3+a|The maximum size of a request body allowed to be cached on disk when retransmitting.
If not set, no limit will be enforced.
If set and the limit is exceeded, an exception will be thrown and therefore the request will neither be sent nor redirected.

In plain CXF, this is equivalent to setting the `bus.io.CachedOutputStream.MaxSize` property on CXF Bus.

See also:

* `xref:reference/extensions/quarkus-cxf.adoc#quarkus-cxf_quarkus-cxf-client-client-name-auto-redirect[quarkus.cxf.client."client-name".auto-redirect]`
* `xref:reference/extensions/quarkus-cxf.adoc#quarkus-cxf_quarkus-cxf-retransmit-cache-threshold[quarkus.cxf.retransmit-cache.threshold]`

*Environment variable*: `+++QUARKUS_CXF_RETRANSMIT_CACHE_MAX_SIZE+++` +
*Since Quarkus CXF*: 3.18.0

.<| [[quarkus-cxf_quarkus-cxf-retransmit-cache-directory]]`link:#quarkus-cxf_quarkus-cxf-retransmit-cache-directory[quarkus.cxf.retransmit-cache.directory]`
.<| `string`
.<|

3+a|A directory where request bodies exceeding
`xref:reference/extensions/quarkus-cxf.adoc#quarkus-cxf_quarkus-cxf-retransmit-cache-threshold[quarkus.cxf.retransmit-cache.threshold]`
will be be stored for retransmission.
If specified, the directory must exist on application startup.
If not specified, the system temporary directory will be used.

In plain CXF, this is equivalent to setting the `bus.io.CachedOutputStream.OutputDirectory` property on CXF Bus.

See also:

* `xref:reference/extensions/quarkus-cxf.adoc#quarkus-cxf_quarkus-cxf-client-client-name-auto-redirect[quarkus.cxf.client."client-name".auto-redirect]`
* `xref:reference/extensions/quarkus-cxf.adoc#quarkus-cxf_quarkus-cxf-retransmit-cache-threshold[quarkus.cxf.retransmit-cache.threshold]`

*Environment variable*: `+++QUARKUS_CXF_RETRANSMIT_CACHE_DIRECTORY+++` +
*Since Quarkus CXF*: 3.18.0

.<| [[quarkus-cxf_quarkus-cxf-retransmit-cache-gc-delay]]`link:#quarkus-cxf_quarkus-cxf-retransmit-cache-gc-delay[quarkus.cxf.retransmit-cache.gc-delay]`
.<| link:https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html[`Duration`] link:#duration-note-anchor-quarkus-cxf[icon:question-circle[title=More information about the Duration format]]
.<| `30M`

3+a|A delay for periodic cleaning of stale temporary files in the
xref:reference/extensions/quarkus-cxf.adoc#quarkus-cxf_quarkus-cxf-retransmit-cache-directory[retransmit cache directory].
Those temporary files are normally removed upon receiving a non-redirect response.
The periodic garbage collection is a fallback mechanism for exceptional conditions.

The minimum value is 2 seconds. If the value of the delay is set to 0, the garbage collection of stale temporary files will be deactivated.

In plain CXF, this is equivalent to setting the `bus.io.CachedOutputStreamCleaner.Delay` property on CXF Bus.

See also:

* `xref:reference/extensions/quarkus-cxf.adoc#quarkus-cxf_quarkus-cxf-client-client-name-auto-redirect[quarkus.cxf.client."client-name".auto-redirect]`

*Environment variable*: `+++QUARKUS_CXF_RETRANSMIT_CACHE_GC_DELAY+++` +
*Since Quarkus CXF*: 3.18.0

.<| [[quarkus-cxf_quarkus-cxf-retransmit-cache-gc-on-shut-down]]`link:#quarkus-cxf_quarkus-cxf-retransmit-cache-gc-on-shut-down[quarkus.cxf.retransmit-cache.gc-on-shut-down]`
.<| `boolean`
.<| `true`

3+a|If `true` and if periodic cleaning of stale temporary files is enabled via
`xref:reference/extensions/quarkus-cxf.adoc#quarkus-cxf_quarkus-cxf-retransmit-cache-gc-delay[quarkus.cxf.retransmit-cache.gc-delay]`
then temporary files will be removed on application shutdown.
Otherwise the stale temporary files in the
xref:reference/extensions/quarkus-cxf.adoc#quarkus-cxf_quarkus-cxf-retransmit-cache-directory[retransmit cache directory]
will not be removed on on application shutdown.

In plain CXF, this is equivalent to setting the `bus.io.CachedOutputStreamCleaner.CleanOnShutdown` property on CXF Bus.

See also:

* `xref:reference/extensions/quarkus-cxf.adoc#quarkus-cxf_quarkus-cxf-client-client-name-auto-redirect[quarkus.cxf.client."client-name".auto-redirect]`

*Environment variable*: `+++QUARKUS_CXF_RETRANSMIT_CACHE_GC_ON_SHUT_DOWN+++` +
*Since Quarkus CXF*: 3.18.0

.<|icon:lock[title=Fixed at build time] [[quarkus-cxf_quarkus-cxf-codegen-wsdl2java-named-parameter-sets-includes]]`link:#quarkus-cxf_quarkus-cxf-codegen-wsdl2java-named-parameter-sets-includes[quarkus.cxf.codegen.wsdl2java."named-parameter-sets".includes]`
.<| List of ``string``
.<|
Expand Down Expand Up @@ -2090,3 +2184,30 @@ enforced unless it is enabled by other means, such as `@org.apache.cxf.annotatio
*Since Quarkus CXF*: 2.7.0
|===

[NOTE]
[id=duration-note-anchor-quarkus-cxf]
.About the Duration format
====
To write duration values, use the standard `java.time.Duration` format.
See the link:https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html#parse(java.lang.CharSequence)[Duration#parse() Java API documentation] for more information.
You can also use a simplified format, starting with a number:
* If the value is only a number, it represents time in seconds.
* If the value is a number followed by `ms`, it represents time in milliseconds.
In other cases, the simplified format is translated to the `java.time.Duration` format for parsing:
* If the value is a number followed by `h`, `m`, or `s`, it is prefixed with `PT`.
* If the value is a number followed by `d`, it is prefixed with `P`.
====

[NOTE]
[id=memory-size-note-anchor-quarkus-cxf]
.About the MemorySize format
====
A size configuration option recognizes strings in this format (shown as a regular expression): `[0-9]+[KkMmGgTtPpEeZzYy]?`.
If no suffix is given, assume bytes.
====

Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import io.quarkiverse.cxf.CXFRecorder;
import io.quarkiverse.cxf.ClientInjectionPoint;
import io.quarkiverse.cxf.CxfClientProducer;
import io.quarkiverse.cxf.CxfConfig;
import io.quarkiverse.cxf.CxfFixedConfig;
import io.quarkiverse.cxf.CxfFixedConfig.ClientFixedConfig;
import io.quarkiverse.cxf.HTTPConduitImpl;
Expand Down Expand Up @@ -482,7 +483,7 @@ private void produceUnremovableBean(

@BuildStep
@Record(ExecutionTime.STATIC_INIT)
void customizers(
void buildTimeBusCustomizers(
CXFRecorder recorder,
CxfFixedConfig config,
List<FeatureBuildItem> features,
Expand All @@ -509,6 +510,15 @@ void customizers(
}
}

@BuildStep
@Record(ExecutionTime.RUNTIME_INIT)
void runtimeBusCustomizers(
CXFRecorder recorder,
CxfConfig config,
BuildProducer<RuntimeBusCustomizerBuildItem> customizers) {
customizers.produce(new RuntimeBusCustomizerBuildItem(recorder.busConfigForRetransmitCache(config)));
}

/**
* Temporary workaround for https://github.com/quarkiverse/quarkus-cxf/issues/1608
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ NativeImageResourceBuildItem nativeImageResourceBuildItem() {
}

@BuildStep
@Record(ExecutionTime.STATIC_INIT)
@Record(ExecutionTime.RUNTIME_INIT)
void setupRuntimeBusCustomizers(
CXFRecorder recorder,
List<RuntimeBusCustomizerBuildItem> customizers) {
Expand Down
Loading

0 comments on commit 34398af

Please sign in to comment.