This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 5b3fa2df443c CAMEL-27217: camel-platform-http-vertx - the route no
longer holds a worker thread while it waits for another thread (#30468)
5b3fa2df443c is described below
commit 5b3fa2df443c249b21b555eed31741cacb265550
Author: allthingssecurity <[email protected]>
AuthorDate: Fri Nov 20 18:19:02 2026 +0530
CAMEL-27217: camel-platform-http-vertx - the route no longer holds a worker
thread while it waits for another thread (#30468)
The consumer ran the route with the synchronous processor inside
executeBlocking, so the
worker thread waited until the route was done. A route that calls
vertx-http on the same
Vert.x (a Vertx in the registry, as in Camel Quarkus) needs a worker thread
to complete
each call, so with as many requests in flight as worker threads every
worker waited and
no request was ever answered again.
The route now starts on the worker thread with the asynchronous processor,
so the worker
is free once the route continues on another thread, and the response is
written on the
context of the request when the route is done.
The worker pool therefore no longer limits how many requests of a route
with an
asynchronous step are in flight. The 4.24 upgrade guide says so, and that a
route which
needs a limit sets one, for example with the Throttle EIP.
CAMEL-27217: camel-platform-http-vertx - option synchronous to run the
route as before
Review: the new behaviour should be configurable. The platform-http
endpoint and component
get the option synchronous (consumer, advanced; currently only used by the
Vert.x engine).
- synchronous=false (the default): the route starts on a worker thread with
the asynchronous
processor, and the worker thread is free once the route continues on
another thread. This
is the fix of this PR, needed for a route that calls an asynchronous
producer on the same
Vert.x (such as vertx-http in Camel Quarkus).
- synchronous=true: the worker thread runs the route with the synchronous
processor in
executeBlocking, as on main, so the worker pool bounds the requests in
flight.
The component option is the default for its endpoints, like requestTimeout.
The component doc
says when to choose each mode, and the 4.24 upgrade guide says which
default and why (Camel 3.x
up to 4.1 also routed this way; the blocking call came in 4.2 with
CAMEL-20011). For a bound in
the asynchronous mode both now give the Throttle EIP in concurrent requests
mode with
asyncDelayed: without asyncDelayed the waiting requests hold the worker
threads again.
VertxPlatformHttpSynchronousTest: with 2 worker threads and a route whose
asynchronous step
completes later on the test thread, synchronous=true (endpoint or component
option) lets only
2 of 4 requests reach the step until some complete; synchronous=false lets
all 4 reach it,
also when the endpoint sets false over a component true.
VertxPlatformHttpSharedVertxWorkerPoolTest runs with the default and with
synchronous=false.
Regenerated: configurers, uri factory, platform-http.json, the catalog
copies and the
endpoint and component DSL.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
.../camel/catalog/components/platform-http.json | 30 +--
.../camel/catalog/docs/platform-http-vertx.adoc | 68 +++++++
.../src/main/docs/platform-http-vertx.adoc | 68 +++++++
.../http/vertx/VertxPlatformHttpConsumer.java | 37 +++-
...VertxPlatformHttpSharedVertxWorkerPoolTest.java | 141 ++++++++++++++
.../vertx/VertxPlatformHttpSynchronousTest.java | 202 +++++++++++++++++++++
.../http/PlatformHttpComponentConfigurer.java | 3 +
.../http/PlatformHttpEndpointConfigurer.java | 3 +
.../http/PlatformHttpEndpointUriFactory.java | 3 +-
.../component/platform/http/platform-http.json | 30 +--
.../platform/http/PlatformHttpComponent.java | 17 ++
.../platform/http/PlatformHttpEndpoint.java | 19 ++
.../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc | 18 ++
.../dsl/PlatformHttpComponentBuilderFactory.java | 25 +++
.../dsl/PlatformHttpEndpointBuilderFactory.java | 54 ++++++
15 files changed, 684 insertions(+), 34 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/platform-http.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/platform-http.json
index d17cbab21e69..77a3096324b2 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/platform-http.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/platform-http.json
@@ -29,9 +29,10 @@
"handleWriteResponseError": { "index": 1, "kind": "property",
"displayName": "Handle Write Response Error", "group": "consumer", "label":
"advanced,consumer", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "When Camel is complete processing the
message, and the HTTP server is writing response. This option controls whether
Camel should catch any failure during writing response [...]
"requestTimeout": { "index": 2, "kind": "property", "displayName":
"Request Timeout", "group": "consumer", "label": "advanced,consumer",
"required": false, "type": "integer", "javaType": "long", "deprecated": false,
"autowired": false, "secret": false, "description": "The period in milliseconds
after which the request should be timed out." },
"serverRequestValidation": { "index": 3, "kind": "property",
"displayName": "Server Request Validation", "group": "consumer", "label":
"advanced,consumer", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "description": "Whether HTTP server should do preliminary
validation of incoming requests, validating if Content-Type\/Accept header,
matches what is allowed according to consumes\/produces c [...]
- "autowiredEnabled": { "index": 4, "kind": "property", "displayName":
"Autowired Enabled", "group": "advanced", "label": "advanced", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description":
"Whether autowiring is enabled. This is used for automatic autowiring options
(the option must be marked as autowired) by looking up in the registry to find
if there is a single instance of matching t [...]
- "engine": { "index": 5, "kind": "property", "displayName": "Engine",
"group": "advanced", "label": "advanced", "required": false, "type": "object",
"javaType": "org.apache.camel.component.platform.http.spi.PlatformHttpEngine",
"deprecated": false, "autowired": false, "secret": false, "description": "An
HTTP Server engine implementation to serve the requests" },
- "headerFilterStrategy": { "index": 6, "kind": "property", "displayName":
"Header Filter Strategy", "group": "filter", "label": "filter", "required":
false, "type": "object", "javaType":
"org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired":
false, "secret": false, "description": "To use a custom
org.apache.camel.spi.HeaderFilterStrategy to filter header to and from Camel
message." }
+ "synchronous": { "index": 4, "kind": "property", "displayName":
"Synchronous", "group": "consumer", "label": "advanced,consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether the consumers route each request synchronously, as the default for the
endpoints of this component. When true, the route runs on a thread of the
Vert.x worker pool, which waits until the route [...]
+ "autowiredEnabled": { "index": 5, "kind": "property", "displayName":
"Autowired Enabled", "group": "advanced", "label": "advanced", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description":
"Whether autowiring is enabled. This is used for automatic autowiring options
(the option must be marked as autowired) by looking up in the registry to find
if there is a single instance of matching t [...]
+ "engine": { "index": 6, "kind": "property", "displayName": "Engine",
"group": "advanced", "label": "advanced", "required": false, "type": "object",
"javaType": "org.apache.camel.component.platform.http.spi.PlatformHttpEngine",
"deprecated": false, "autowired": false, "secret": false, "description": "An
HTTP Server engine implementation to serve the requests" },
+ "headerFilterStrategy": { "index": 7, "kind": "property", "displayName":
"Header Filter Strategy", "group": "filter", "label": "filter", "required":
false, "type": "object", "javaType":
"org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired":
false, "secret": false, "description": "To use a custom
org.apache.camel.spi.HeaderFilterStrategy to filter header to and from Camel
message." }
},
"bodyTypes": {
"consumerOut": { "carriers": [ "stream", "bytes", "null", "map", "file" ],
"byOption": [ { "option": "useBodyHandler", "value": "false", "carriers": [
"pojo" ] } ], "description": "The request body: the stream cache with the
Vert.x engine, a byte array with Spring Boot; null for a request without a
body, such as a GET; a Map of the fields of a form (populateBodyWithForm); a
File for an upload" },
@@ -55,16 +56,17 @@
"requestTimeout": { "index": 14, "kind": "parameter", "displayName":
"Request Timeout", "group": "consumer", "label": "advanced,consumer",
"required": false, "type": "integer", "javaType": "long", "deprecated": false,
"autowired": false, "secret": false, "description": "The period in milliseconds
after which the request should be timed out." },
"returnHttpRequestHeaders": { "index": 15, "kind": "parameter",
"displayName": "Return Http Request Headers", "group": "consumer", "label":
"advanced,consumer", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether to include HTTP request headers
(Accept, User-Agent, etc.) into HTTP response produced by this endpoint." },
"stripUriPrefix": { "index": 16, "kind": "parameter", "displayName":
"Strip Uri Prefix", "group": "consumer", "label": "consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether to strip the registered consumer path from CamelHttpPath after the
request has been matched, so the exchange sees the path relative to this
consumer instead of the full raw request path. Comb [...]
- "useBodyHandler": { "index": 17, "kind": "parameter", "displayName": "Use
Body Handler", "group": "consumer", "label": "advanced,consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description":
"Whether to use BodyHandler for the request. If set to false then the request
will no be read and parsed." },
- "useCookieHandler": { "index": 18, "kind": "parameter", "displayName":
"Use Cookie Handler", "group": "consumer", "label": "advanced,consumer",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"description": "Whether to enable the Cookie Handler that allows Cookie
addition, expiry, and retrieval (currently only supported by
camel-platform-http-vertx)" },
- "useStreaming": { "index": 19, "kind": "parameter", "displayName": "Use
Streaming", "group": "consumer", "label": "advanced,consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether to use streaming for large requests and responses (currently only
supported by camel-platform-http-vertx)" },
- "bridgeErrorHandler": { "index": 20, "kind": "parameter", "displayName":
"Bridge Error Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Allows for bridging the consumer to the
Camel routing Error Handler, which mean any exceptions (if possible) occurred
while the Camel consumer is trying to pickup incoming [...]
- "exceptionHandler": { "index": 21, "kind": "parameter", "displayName":
"Exception Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.",
"deprecated": false, "autowired": false, "secret": false, "description": "To
let the consumer use a custom ExceptionHandler. Notice if the option
bridgeErrorHandler is enabled then this option is not in use. By de [...]
- "exchangePattern": { "index": 22, "kind": "parameter", "displayName":
"Exchange Pattern", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "enum", "javaType":
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ],
"deprecated": false, "autowired": false, "secret": false, "description": "Sets
the exchange pattern when the consumer creates an exchange." },
- "fileNameExtWhitelist": { "index": 23, "kind": "parameter", "displayName":
"File Name Ext Whitelist", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "A comma or whitespace separated list of file extensions.
Uploads having these extensions will be stored locally. Null value or asterisk
(*) will allow all files." },
- "unmatchedRequestHandling": { "index": 24, "kind": "parameter",
"displayName": "Unmatched Request Handling", "group": "consumer (advanced)",
"label": "consumer,advanced", "required": false, "type": "enum", "javaType":
"java.lang.String", "enum": [ "platform", "camel" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "platform", "description":
"Who answers requests that match no registered operation when using rest-dsl
contract-first (such as the rest-openap [...]
- "headerFilterStrategy": { "index": 25, "kind": "parameter", "displayName":
"Header Filter Strategy", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired":
false, "secret": false, "description": "To use a custom HeaderFilterStrategy to
filter headers to and from Camel message." },
- "platformHttpEngine": { "index": 26, "kind": "parameter", "displayName":
"Platform Http Engine", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"org.apache.camel.component.platform.http.spi.PlatformHttpEngine",
"deprecated": false, "autowired": false, "secret": false, "description": "An
HTTP Server engine implementation to serve the requests of this endpoint." },
- "oauthProfile": { "index": 27, "kind": "parameter", "displayName": "OAuth
Profile", "group": "security", "label": "consumer,security", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "OAuth profile name for
validating incoming Authorization: Bearer tokens. When set, the request is
authenticated before the route is processed. This requires an
OAuthTokenValidationFactory; camel-oauth provides [...]
+ "synchronous": { "index": 17, "kind": "parameter", "displayName":
"Synchronous", "group": "consumer", "label": "advanced,consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether the consumer routes each request synchronously. When true, the route
runs on a thread of the Vert.x worker pool, which waits until the route is
complete, so the size of the worker pool limit [...]
+ "useBodyHandler": { "index": 18, "kind": "parameter", "displayName": "Use
Body Handler", "group": "consumer", "label": "advanced,consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description":
"Whether to use BodyHandler for the request. If set to false then the request
will no be read and parsed." },
+ "useCookieHandler": { "index": 19, "kind": "parameter", "displayName":
"Use Cookie Handler", "group": "consumer", "label": "advanced,consumer",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"description": "Whether to enable the Cookie Handler that allows Cookie
addition, expiry, and retrieval (currently only supported by
camel-platform-http-vertx)" },
+ "useStreaming": { "index": 20, "kind": "parameter", "displayName": "Use
Streaming", "group": "consumer", "label": "advanced,consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether to use streaming for large requests and responses (currently only
supported by camel-platform-http-vertx)" },
+ "bridgeErrorHandler": { "index": 21, "kind": "parameter", "displayName":
"Bridge Error Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Allows for bridging the consumer to the
Camel routing Error Handler, which mean any exceptions (if possible) occurred
while the Camel consumer is trying to pickup incoming [...]
+ "exceptionHandler": { "index": 22, "kind": "parameter", "displayName":
"Exception Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.",
"deprecated": false, "autowired": false, "secret": false, "description": "To
let the consumer use a custom ExceptionHandler. Notice if the option
bridgeErrorHandler is enabled then this option is not in use. By de [...]
+ "exchangePattern": { "index": 23, "kind": "parameter", "displayName":
"Exchange Pattern", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "enum", "javaType":
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ],
"deprecated": false, "autowired": false, "secret": false, "description": "Sets
the exchange pattern when the consumer creates an exchange." },
+ "fileNameExtWhitelist": { "index": 24, "kind": "parameter", "displayName":
"File Name Ext Whitelist", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "A comma or whitespace separated list of file extensions.
Uploads having these extensions will be stored locally. Null value or asterisk
(*) will allow all files." },
+ "unmatchedRequestHandling": { "index": 25, "kind": "parameter",
"displayName": "Unmatched Request Handling", "group": "consumer (advanced)",
"label": "consumer,advanced", "required": false, "type": "enum", "javaType":
"java.lang.String", "enum": [ "platform", "camel" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "platform", "description":
"Who answers requests that match no registered operation when using rest-dsl
contract-first (such as the rest-openap [...]
+ "headerFilterStrategy": { "index": 26, "kind": "parameter", "displayName":
"Header Filter Strategy", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired":
false, "secret": false, "description": "To use a custom HeaderFilterStrategy to
filter headers to and from Camel message." },
+ "platformHttpEngine": { "index": 27, "kind": "parameter", "displayName":
"Platform Http Engine", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"org.apache.camel.component.platform.http.spi.PlatformHttpEngine",
"deprecated": false, "autowired": false, "secret": false, "description": "An
HTTP Server engine implementation to serve the requests of this endpoint." },
+ "oauthProfile": { "index": 28, "kind": "parameter", "displayName": "OAuth
Profile", "group": "security", "label": "consumer,security", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "OAuth profile name for
validating incoming Authorization: Bearer tokens. When set, the request is
authenticated before the route is processed. This requires an
OAuthTokenValidationFactory; camel-oauth provides [...]
}
}
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/platform-http-vertx.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/platform-http-vertx.adoc
index ee923da129a8..56b35431d485 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/platform-http-vertx.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/platform-http-vertx.adoc
@@ -96,6 +96,74 @@ The body of the reply is written as text, bytes or a stream.
Text is written in
`setBody(constant(42))` replies with `42`. A Map, a List or an object must be
marshalled first (for example with
`marshal().json()`), or the consumer answers `500`.
+== Synchronous or asynchronous routing
+
+Each request is routed on a thread of the Vert.x worker pool, as the first
steps of a route may block. The
+`synchronous` option of the `platform-http` endpoint decides whether this
worker thread waits until the route is
+complete. The same option on the `platform-http` component sets the default
for all its endpoints.
+
+In both modes, when the route continues on another thread (for example after
an asynchronous producer such as
+`vertx-http`), the rest of the route runs on that thread, and the response is
written when the route is complete. A
+route that is synchronous to its end (no asynchronous step) runs the same way
in both modes: on the worker thread.
+
+`synchronous=false` (the default)::
+The route runs with the asynchronous routing engine, and the worker thread is
free for the next request as soon as the
+route continues on another thread. So the size of the worker pool does not
limit how many requests of such a route
+are in flight. Choose this mode when a route calls an asynchronous producer
that uses the same Vert.x as the HTTP
+server, such as `vertx-http` with a Vert.x instance in the registry (as in
Camel Quarkus). Such a producer needs a
+worker thread of that Vert.x to complete its exchange, and with
`synchronous=true` the requests in flight can hold
+every worker thread, so that no request completes any more. The consumer
worked this way from Camel 3.6 to 4.1.
+
+`synchronous=true`::
+The worker thread waits until the route is complete, also while the route
waits for an asynchronous step. So the size
+of the worker pool limits how many requests are routed at the same time, and
further requests wait for a free worker
+thread. Choose this mode when you rely on that limit, for example to bound the
number of concurrent calls to a
+backend, and the route does not call an asynchronous producer on the same
Vert.x. The consumer worked this way from
+Camel 4.2 to 4.23.
+
+[tabs]
+====
+Java::
++
+[source,java]
+----
+from("platform-http:/orders?synchronous=true")
+ .to("bean:orderService");
+----
+
+XML::
++
+[source,xml]
+----
+<route>
+ <from uri="platform-http:/orders?synchronous=true"/>
+ <to uri="bean:orderService"/>
+</route>
+----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+ from:
+ uri: platform-http:/orders
+ parameters:
+ synchronous: true
+ steps:
+ - to:
+ uri: bean:orderService
+----
+====
+
+To use the synchronous mode for all routes, set
`camel.component.platform-http.synchronous=true`.
+
+A route in the asynchronous mode that needs a bound on the requests in flight
can use the
+xref:eips:throttle-eip.adoc[Throttle] EIP in concurrent requests mode with
`asyncDelayed`, for example
+`throttle(10).concurrentRequestsMode().asyncDelayed()`. With `asyncDelayed`, a
request that waits for a permit does
+not hold a worker thread either. Without it, the waiting requests hold the
worker threads, and on a shared Vert.x
+they can again hold every worker thread that the asynchronous producer needs.
+
== Handling large request / response payloads
When large request / response payloads are expected, there is a `useStreaming`
option, which can be enabled to improve performance.
diff --git
a/components/camel-platform-http-vertx/src/main/docs/platform-http-vertx.adoc
b/components/camel-platform-http-vertx/src/main/docs/platform-http-vertx.adoc
index ee923da129a8..56b35431d485 100644
---
a/components/camel-platform-http-vertx/src/main/docs/platform-http-vertx.adoc
+++
b/components/camel-platform-http-vertx/src/main/docs/platform-http-vertx.adoc
@@ -96,6 +96,74 @@ The body of the reply is written as text, bytes or a stream.
Text is written in
`setBody(constant(42))` replies with `42`. A Map, a List or an object must be
marshalled first (for example with
`marshal().json()`), or the consumer answers `500`.
+== Synchronous or asynchronous routing
+
+Each request is routed on a thread of the Vert.x worker pool, as the first
steps of a route may block. The
+`synchronous` option of the `platform-http` endpoint decides whether this
worker thread waits until the route is
+complete. The same option on the `platform-http` component sets the default
for all its endpoints.
+
+In both modes, when the route continues on another thread (for example after
an asynchronous producer such as
+`vertx-http`), the rest of the route runs on that thread, and the response is
written when the route is complete. A
+route that is synchronous to its end (no asynchronous step) runs the same way
in both modes: on the worker thread.
+
+`synchronous=false` (the default)::
+The route runs with the asynchronous routing engine, and the worker thread is
free for the next request as soon as the
+route continues on another thread. So the size of the worker pool does not
limit how many requests of such a route
+are in flight. Choose this mode when a route calls an asynchronous producer
that uses the same Vert.x as the HTTP
+server, such as `vertx-http` with a Vert.x instance in the registry (as in
Camel Quarkus). Such a producer needs a
+worker thread of that Vert.x to complete its exchange, and with
`synchronous=true` the requests in flight can hold
+every worker thread, so that no request completes any more. The consumer
worked this way from Camel 3.6 to 4.1.
+
+`synchronous=true`::
+The worker thread waits until the route is complete, also while the route
waits for an asynchronous step. So the size
+of the worker pool limits how many requests are routed at the same time, and
further requests wait for a free worker
+thread. Choose this mode when you rely on that limit, for example to bound the
number of concurrent calls to a
+backend, and the route does not call an asynchronous producer on the same
Vert.x. The consumer worked this way from
+Camel 4.2 to 4.23.
+
+[tabs]
+====
+Java::
++
+[source,java]
+----
+from("platform-http:/orders?synchronous=true")
+ .to("bean:orderService");
+----
+
+XML::
++
+[source,xml]
+----
+<route>
+ <from uri="platform-http:/orders?synchronous=true"/>
+ <to uri="bean:orderService"/>
+</route>
+----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+ from:
+ uri: platform-http:/orders
+ parameters:
+ synchronous: true
+ steps:
+ - to:
+ uri: bean:orderService
+----
+====
+
+To use the synchronous mode for all routes, set
`camel.component.platform-http.synchronous=true`.
+
+A route in the asynchronous mode that needs a bound on the requests in flight
can use the
+xref:eips:throttle-eip.adoc[Throttle] EIP in concurrent requests mode with
`asyncDelayed`, for example
+`throttle(10).concurrentRequestsMode().asyncDelayed()`. With `asyncDelayed`, a
request that waits for a permit does
+not hold a worker thread either. Without it, the waiting requests hold the
worker threads, and on a shared Vert.x
+they can again hold every worker thread that the asynchronous producer needs.
+
== Handling large request / response payloads
When large request / response payloads are expected, there is a `useStreaming`
option, which can be enabled to improve performance.
diff --git
a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java
b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java
index 6f19718b9004..7e64e5924554 100644
---
a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java
+++
b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java
@@ -27,9 +27,11 @@ import java.util.regex.Pattern;
import jakarta.activation.DataHandler;
+import io.vertx.core.Context;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.MultiMap;
+import io.vertx.core.Promise;
import io.vertx.core.Vertx;
import io.vertx.core.http.Cookie;
import io.vertx.core.http.CookieSameSite;
@@ -366,7 +368,7 @@ public class VertxPlatformHttpConsumer extends
DefaultConsumer
populateMultiFormData(ctx, exchange.getIn(),
getEndpoint().getHeaderFilterStrategy());
}
- vertx.executeBlocking(() -> processExchange(exchange),
false).onComplete(processExchangeResult -> {
+ processExchange(vertx, exchange).onComplete(processExchangeResult
-> {
if (processExchangeResult.succeeded()) {
writeResponse(ctx, exchange,
getEndpoint().getHeaderFilterStrategy(), muteExceptions)
.onComplete(writeResponseResult -> {
@@ -425,10 +427,35 @@ public class VertxPlatformHttpConsumer extends
DefaultConsumer
handleExchangeComplete(exchange);
}
- private Object processExchange(Exchange exchange) throws Exception {
- createUoW(exchange);
- getProcessor().process(exchange);
- return null;
+ /**
+ * Routes the exchange, starting on a thread of the Vert.x worker pool, as
the first steps of the route may block.
+ * The returned future completes on the context of the request, when the
route is done.
+ * <p>
+ * With the endpoint option {@code synchronous=true} the worker thread
runs the route with the synchronous
+ * processor, so it is held until the route completes, and the worker pool
bounds the requests in flight.
+ * <p>
+ * Otherwise (the default) the route runs with the asynchronous processor,
and the worker thread is not held until
+ * the route completes: when the route continues on another thread, such
as a vertx-http producer that completes its
+ * exchange on a worker thread of the same Vert.x, a worker thread waiting
for the route could be the one that the
+ * other thread needs, and with every worker thread waiting no request
would ever complete.
+ */
+ private Future<Void> processExchange(Vertx vertx, Exchange exchange) {
+ if (getEndpoint().isSynchronous()) {
+ return vertx.executeBlocking(() -> {
+ createUoW(exchange);
+ getProcessor().process(exchange);
+ return null;
+ }, false);
+ }
+
+ Context context = vertx.getOrCreateContext();
+ Promise<Void> done = Promise.promise();
+ vertx.executeBlocking(() -> {
+ createUoW(exchange);
+ getAsyncProcessor().process(exchange, doneSync ->
context.runOnContext(v -> done.tryComplete()));
+ return null;
+ }, false).onFailure(done::tryFail);
+ return done.future();
}
private void configureSecurityHandler(Route route) {
diff --git
a/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpSharedVertxWorkerPoolTest.java
b/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpSharedVertxWorkerPoolTest.java
new file mode 100644
index 000000000000..0d815bb0cf9e
--- /dev/null
+++
b/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpSharedVertxWorkerPoolTest.java
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.platform.http.vertx;
+
+import java.net.InetSocketAddress;
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+import java.nio.charset.StandardCharsets;
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+import com.sun.net.httpserver.HttpServer;
+import io.vertx.core.Vertx;
+import io.vertx.core.VertxOptions;
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.test.AvailablePortFinder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * A platform-http route that calls vertx-http, with one Vert.x for both (a
Vert.x in the registry, as in Camel
+ * Quarkus): the route must not hold a worker thread of the Vert.x until it
completes, as vertx-http completes its
+ * exchange on a worker thread of the same Vert.x. With as many requests in
flight as worker threads, no request would
+ * complete. This needs the asynchronous mode of the consumer ({@code
synchronous=false}, the default); see
+ * {@link VertxPlatformHttpSynchronousTest} for {@code synchronous=true}.
+ */
+class VertxPlatformHttpSharedVertxWorkerPoolTest {
+
+ private static final int WORKERS = 2;
+
+ @RegisterExtension
+ AvailablePortFinder.Port port = AvailablePortFinder.find();
+
+ private Vertx vertx;
+ private HttpServer backend;
+ private ExecutorService backendThreads;
+
+ @BeforeEach
+ void setUp() throws Exception {
+ vertx = Vertx.vertx(new VertxOptions().setWorkerPoolSize(WORKERS));
+ backend = HttpServer.create(new InetSocketAddress("localhost", 0), 0);
+ // the backend answers once every request has arrived, so each request
holds a worker thread meanwhile when the
+ // route does not give it back
+ CountDownLatch arrived = new CountDownLatch(WORKERS);
+ backend.createContext("/backend", exchange -> {
+ arrived.countDown();
+ try {
+ arrived.await(5, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ byte[] body = "Hello from
backend".getBytes(StandardCharsets.UTF_8);
+ exchange.sendResponseHeaders(200, body.length);
+ exchange.getResponseBody().write(body);
+ exchange.close();
+ });
+ backendThreads = Executors.newCachedThreadPool();
+ backend.setExecutor(backendThreads);
+ backend.start();
+ }
+
+ @AfterEach
+ void tearDown() {
+ backend.stop(0);
+ backendThreads.shutdownNow();
+ vertx.close();
+ }
+
+ @Test
+ void requestsAsManyAsWorkerThreadsComplete() throws Exception {
+ // synchronous=false is the default
+ assertRequestsAsManyAsWorkerThreadsComplete("");
+ }
+
+ @Test
+ void requestsAsManyAsWorkerThreadsCompleteWithSynchronousFalse() throws
Exception {
+ assertRequestsAsManyAsWorkerThreadsComplete("?synchronous=false");
+ }
+
+ private void assertRequestsAsManyAsWorkerThreadsComplete(String query)
throws Exception {
+ try (CamelContext context = new DefaultCamelContext()) {
+ VertxPlatformHttpServerConfiguration configuration = new
VertxPlatformHttpServerConfiguration();
+ configuration.setBindPort(port.getPort());
+
+ context.getShutdownStrategy().setTimeout(5);
+ context.getRegistry().bind("vertx", vertx);
+ context.addService(new VertxPlatformHttpServer(configuration));
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("platform-http:/proxy" + query)
+ // call the backend uri, not the uri of the request
+ .removeHeaders("CamelHttp*")
+ .to("vertx-http:http://localhost:" +
backend.getAddress().getPort() + "/backend");
+ }
+ });
+ context.start();
+
+ HttpClient client = HttpClient.newHttpClient();
+ HttpRequest request =
HttpRequest.newBuilder(URI.create("http://localhost:" + port.getPort() +
"/proxy"))
+ .timeout(Duration.ofSeconds(10)).GET().build();
+ List<CompletableFuture<HttpResponse<String>>> responses = new
ArrayList<>();
+ for (int i = 0; i < WORKERS; i++) {
+ responses.add(client.sendAsync(request,
HttpResponse.BodyHandlers.ofString()));
+ }
+ for (CompletableFuture<HttpResponse<String>> response : responses)
{
+ HttpResponse<String> r = response.get(15, TimeUnit.SECONDS);
+ assertEquals(200, r.statusCode());
+ assertEquals("Hello from backend", r.body());
+ }
+ }
+ }
+}
diff --git
a/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpSynchronousTest.java
b/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpSynchronousTest.java
new file mode 100644
index 000000000000..1d1890ca8799
--- /dev/null
+++
b/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpSynchronousTest.java
@@ -0,0 +1,202 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.platform.http.vertx;
+
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.Queue;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import io.vertx.core.Vertx;
+import io.vertx.core.VertxOptions;
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.platform.http.PlatformHttpComponent;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.support.AsyncProcessorSupport;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.awaitility.Awaitility.await;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * The {@code synchronous} option: with {@code synchronous=true} a worker
thread runs the route to its end, also when
+ * the route waits for an asynchronous step, so the worker pool bounds the
requests in flight. With
+ * {@code synchronous=false} (the default) the worker thread is free once the
route waits for the asynchronous step. See
+ * {@link VertxPlatformHttpSharedVertxWorkerPoolTest} for a route that needs
the asynchronous mode.
+ */
+class VertxPlatformHttpSynchronousTest {
+
+ private static final int WORKERS = 2;
+ private static final int REQUESTS = 4;
+
+ private Vertx vertx;
+ // the server listens on a port the OS picks when it binds, so no other
socket can take it in between
+ private VertxPlatformHttpServer server;
+ // the requests that reached the asynchronous step and wait for it to
complete
+ private final Queue<AsyncCallback> waiting = new ConcurrentLinkedQueue<>();
+ private final AtomicInteger arrived = new AtomicInteger();
+ private final AtomicInteger notOnWorker = new AtomicInteger();
+ private CountDownLatch arrivedLatch;
+
+ @BeforeEach
+ void setUp() {
+ vertx = Vertx.vertx(new VertxOptions().setWorkerPoolSize(WORKERS));
+ }
+
+ @AfterEach
+ void tearDown() {
+ vertx.close();
+ }
+
+ @Test
+ void synchronousEndpointOptionBoundsRequestsInFlightByWorkerPool() throws
Exception {
+ assertWorkerPoolBoundsRequestsInFlight(runRoute("?synchronous=true",
false));
+ }
+
+ @Test
+ void synchronousComponentOptionBoundsRequestsInFlightByWorkerPool() throws
Exception {
+ assertWorkerPoolBoundsRequestsInFlight(runRoute("", true));
+ }
+
+ @Test
+ void asynchronousDoesNotHoldWorkerThreads() throws Exception {
+ assertWorkerThreadsAreNotHeld(runRoute("?synchronous=false", false));
+ }
+
+ @Test
+ void endpointOptionOverridesComponentOption() throws Exception {
+ assertWorkerThreadsAreNotHeld(runRoute("?synchronous=false", true));
+ }
+
+ private void assertWorkerThreadsAreNotHeld(CamelContext context) throws
Exception {
+ try (context) {
+ List<CompletableFuture<HttpResponse<String>>> responses =
sendRequests();
+
+ // every request reaches the asynchronous step, although there are
only WORKERS worker threads
+ assertTrue(arrivedLatch.await(10, TimeUnit.SECONDS),
+ "Only " + arrived.get() + " of " + REQUESTS + " requests
reached the asynchronous step");
+ assertEquals(REQUESTS, waiting.size());
+
+ completeWaiting(REQUESTS);
+ assertResponses(responses);
+ assertEquals(0, notOnWorker.get(), "The route did not start on a
Vert.x worker thread");
+ }
+ }
+
+ private void assertWorkerPoolBoundsRequestsInFlight(CamelContext context)
throws Exception {
+ try (context) {
+ List<CompletableFuture<HttpResponse<String>>> responses =
sendRequests();
+
+ // each worker thread waits until its route completes, so only
WORKERS requests reach the asynchronous step
+ assertTrue(arrivedLatch.await(10, TimeUnit.SECONDS),
+ "Only " + arrived.get() + " requests reached the
asynchronous step");
+ await().during(500, TimeUnit.MILLISECONDS).atMost(5,
TimeUnit.SECONDS)
+ .untilAsserted(() -> assertEquals(WORKERS, arrived.get(),
+ "The worker pool did not bound the requests in
flight"));
+ assertEquals(WORKERS, waiting.size());
+
+ // once the first requests complete, the worker threads route the
next ones
+ completeWaiting(REQUESTS);
+ assertResponses(responses);
+ assertEquals(REQUESTS, arrived.get());
+ assertEquals(0, notOnWorker.get(), "The route did not start on a
Vert.x worker thread");
+ }
+ }
+
+ private CamelContext runRoute(String query, boolean synchronousComponent)
throws Exception {
+ // in synchronous mode only WORKERS requests arrive before some
complete
+ arrivedLatch = new CountDownLatch(query.contains("synchronous=false")
? REQUESTS : WORKERS);
+
+ CamelContext context = new DefaultCamelContext();
+ VertxPlatformHttpServerConfiguration configuration = new
VertxPlatformHttpServerConfiguration();
+ configuration.setBindPort(0);
+
+ context.getShutdownStrategy().setTimeout(5);
+ context.getRegistry().bind("vertx", vertx);
+ server = new VertxPlatformHttpServer(configuration);
+ context.addService(server);
+ if (synchronousComponent) {
+ context.getComponent("platform-http",
PlatformHttpComponent.class).setSynchronous(true);
+ }
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("platform-http:/inflight" + query)
+ .process(new AsyncProcessorSupport() {
+ @Override
+ public boolean process(Exchange exchange,
AsyncCallback callback) {
+ if
(!Thread.currentThread().getName().startsWith("vert.x-worker-thread")) {
+ notOnWorker.incrementAndGet();
+ }
+ // the step completes later, on another thread
+ waiting.add(callback);
+ arrived.incrementAndGet();
+ arrivedLatch.countDown();
+ return false;
+ }
+ })
+ .setBody().constant("Done");
+ }
+ });
+ context.start();
+ return context;
+ }
+
+ private List<CompletableFuture<HttpResponse<String>>> sendRequests() {
+ HttpClient client = HttpClient.newHttpClient();
+ HttpRequest request
+ = HttpRequest.newBuilder(URI.create("http://localhost:" +
server.getServer().actualPort() + "/inflight"))
+ .timeout(Duration.ofSeconds(20)).GET().build();
+ List<CompletableFuture<HttpResponse<String>>> responses = new
ArrayList<>();
+ for (int i = 0; i < REQUESTS; i++) {
+ responses.add(client.sendAsync(request,
HttpResponse.BodyHandlers.ofString()));
+ }
+ return responses;
+ }
+
+ private void completeWaiting(int count) {
+ for (int i = 0; i < count; i++) {
+ // the step completes on this thread, not on a Vert.x thread
+ AsyncCallback callback = await().atMost(15,
TimeUnit.SECONDS).until(waiting::poll, Objects::nonNull);
+ callback.done(false);
+ }
+ }
+
+ private static void
assertResponses(List<CompletableFuture<HttpResponse<String>>> responses) throws
Exception {
+ for (CompletableFuture<HttpResponse<String>> response : responses) {
+ HttpResponse<String> r = response.get(15, TimeUnit.SECONDS);
+ assertEquals(200, r.statusCode());
+ assertEquals("Done", r.body());
+ }
+ }
+}
diff --git
a/components/camel-platform-http/src/generated/java/org/apache/camel/component/platform/http/PlatformHttpComponentConfigurer.java
b/components/camel-platform-http/src/generated/java/org/apache/camel/component/platform/http/PlatformHttpComponentConfigurer.java
index cbf0690055b3..8aacab0314cf 100644
---
a/components/camel-platform-http/src/generated/java/org/apache/camel/component/platform/http/PlatformHttpComponentConfigurer.java
+++
b/components/camel-platform-http/src/generated/java/org/apache/camel/component/platform/http/PlatformHttpComponentConfigurer.java
@@ -37,6 +37,7 @@ public class PlatformHttpComponentConfigurer extends
PropertyConfigurerSupport i
case "requestTimeout": target.setRequestTimeout(property(camelContext,
long.class, value)); return true;
case "serverrequestvalidation":
case "serverRequestValidation":
target.setServerRequestValidation(property(camelContext, boolean.class,
value)); return true;
+ case "synchronous": target.setSynchronous(property(camelContext,
boolean.class, value)); return true;
default: return false;
}
}
@@ -57,6 +58,7 @@ public class PlatformHttpComponentConfigurer extends
PropertyConfigurerSupport i
case "requestTimeout": return long.class;
case "serverrequestvalidation":
case "serverRequestValidation": return boolean.class;
+ case "synchronous": return boolean.class;
default: return null;
}
}
@@ -78,6 +80,7 @@ public class PlatformHttpComponentConfigurer extends
PropertyConfigurerSupport i
case "requestTimeout": return target.getRequestTimeout();
case "serverrequestvalidation":
case "serverRequestValidation": return
target.isServerRequestValidation();
+ case "synchronous": return target.isSynchronous();
default: return null;
}
}
diff --git
a/components/camel-platform-http/src/generated/java/org/apache/camel/component/platform/http/PlatformHttpEndpointConfigurer.java
b/components/camel-platform-http/src/generated/java/org/apache/camel/component/platform/http/PlatformHttpEndpointConfigurer.java
index ea944a5977ac..ca4fca5d4172 100644
---
a/components/camel-platform-http/src/generated/java/org/apache/camel/component/platform/http/PlatformHttpEndpointConfigurer.java
+++
b/components/camel-platform-http/src/generated/java/org/apache/camel/component/platform/http/PlatformHttpEndpointConfigurer.java
@@ -68,6 +68,7 @@ public class PlatformHttpEndpointConfigurer extends
PropertyConfigurerSupport im
case "returnHttpRequestHeaders":
target.setReturnHttpRequestHeaders(property(camelContext, boolean.class,
value)); return true;
case "stripuriprefix":
case "stripUriPrefix": target.setStripUriPrefix(property(camelContext,
boolean.class, value)); return true;
+ case "synchronous": target.setSynchronous(property(camelContext,
boolean.class, value)); return true;
case "unmatchedrequesthandling":
case "unmatchedRequestHandling":
target.setUnmatchedRequestHandling(property(camelContext,
java.lang.String.class, value)); return true;
case "usebodyhandler":
@@ -127,6 +128,7 @@ public class PlatformHttpEndpointConfigurer extends
PropertyConfigurerSupport im
case "returnHttpRequestHeaders": return boolean.class;
case "stripuriprefix":
case "stripUriPrefix": return boolean.class;
+ case "synchronous": return boolean.class;
case "unmatchedrequesthandling":
case "unmatchedRequestHandling": return java.lang.String.class;
case "usebodyhandler":
@@ -187,6 +189,7 @@ public class PlatformHttpEndpointConfigurer extends
PropertyConfigurerSupport im
case "returnHttpRequestHeaders": return
target.isReturnHttpRequestHeaders();
case "stripuriprefix":
case "stripUriPrefix": return target.isStripUriPrefix();
+ case "synchronous": return target.isSynchronous();
case "unmatchedrequesthandling":
case "unmatchedRequestHandling": return
target.getUnmatchedRequestHandling();
case "usebodyhandler":
diff --git
a/components/camel-platform-http/src/generated/java/org/apache/camel/component/platform/http/PlatformHttpEndpointUriFactory.java
b/components/camel-platform-http/src/generated/java/org/apache/camel/component/platform/http/PlatformHttpEndpointUriFactory.java
index a55a7bc06a59..4c0a5ef073e9 100644
---
a/components/camel-platform-http/src/generated/java/org/apache/camel/component/platform/http/PlatformHttpEndpointUriFactory.java
+++
b/components/camel-platform-http/src/generated/java/org/apache/camel/component/platform/http/PlatformHttpEndpointUriFactory.java
@@ -24,7 +24,7 @@ public class PlatformHttpEndpointUriFactory extends
org.apache.camel.support.com
private static final Set<String> ENDPOINT_IDENTITY_PROPERTY_NAMES;
private static final Map<String, String> MULTI_VALUE_PREFIXES;
static {
- Set<String> props = new HashSet<>(28);
+ Set<String> props = new HashSet<>(29);
props.add("bridgeErrorHandler");
props.add("consumes");
props.add("cookieDomain");
@@ -49,6 +49,7 @@ public class PlatformHttpEndpointUriFactory extends
org.apache.camel.support.com
props.add("requestTimeout");
props.add("returnHttpRequestHeaders");
props.add("stripUriPrefix");
+ props.add("synchronous");
props.add("unmatchedRequestHandling");
props.add("useBodyHandler");
props.add("useCookieHandler");
diff --git
a/components/camel-platform-http/src/generated/resources/META-INF/org/apache/camel/component/platform/http/platform-http.json
b/components/camel-platform-http/src/generated/resources/META-INF/org/apache/camel/component/platform/http/platform-http.json
index d17cbab21e69..77a3096324b2 100644
---
a/components/camel-platform-http/src/generated/resources/META-INF/org/apache/camel/component/platform/http/platform-http.json
+++
b/components/camel-platform-http/src/generated/resources/META-INF/org/apache/camel/component/platform/http/platform-http.json
@@ -29,9 +29,10 @@
"handleWriteResponseError": { "index": 1, "kind": "property",
"displayName": "Handle Write Response Error", "group": "consumer", "label":
"advanced,consumer", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "When Camel is complete processing the
message, and the HTTP server is writing response. This option controls whether
Camel should catch any failure during writing response [...]
"requestTimeout": { "index": 2, "kind": "property", "displayName":
"Request Timeout", "group": "consumer", "label": "advanced,consumer",
"required": false, "type": "integer", "javaType": "long", "deprecated": false,
"autowired": false, "secret": false, "description": "The period in milliseconds
after which the request should be timed out." },
"serverRequestValidation": { "index": 3, "kind": "property",
"displayName": "Server Request Validation", "group": "consumer", "label":
"advanced,consumer", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "description": "Whether HTTP server should do preliminary
validation of incoming requests, validating if Content-Type\/Accept header,
matches what is allowed according to consumes\/produces c [...]
- "autowiredEnabled": { "index": 4, "kind": "property", "displayName":
"Autowired Enabled", "group": "advanced", "label": "advanced", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description":
"Whether autowiring is enabled. This is used for automatic autowiring options
(the option must be marked as autowired) by looking up in the registry to find
if there is a single instance of matching t [...]
- "engine": { "index": 5, "kind": "property", "displayName": "Engine",
"group": "advanced", "label": "advanced", "required": false, "type": "object",
"javaType": "org.apache.camel.component.platform.http.spi.PlatformHttpEngine",
"deprecated": false, "autowired": false, "secret": false, "description": "An
HTTP Server engine implementation to serve the requests" },
- "headerFilterStrategy": { "index": 6, "kind": "property", "displayName":
"Header Filter Strategy", "group": "filter", "label": "filter", "required":
false, "type": "object", "javaType":
"org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired":
false, "secret": false, "description": "To use a custom
org.apache.camel.spi.HeaderFilterStrategy to filter header to and from Camel
message." }
+ "synchronous": { "index": 4, "kind": "property", "displayName":
"Synchronous", "group": "consumer", "label": "advanced,consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether the consumers route each request synchronously, as the default for the
endpoints of this component. When true, the route runs on a thread of the
Vert.x worker pool, which waits until the route [...]
+ "autowiredEnabled": { "index": 5, "kind": "property", "displayName":
"Autowired Enabled", "group": "advanced", "label": "advanced", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description":
"Whether autowiring is enabled. This is used for automatic autowiring options
(the option must be marked as autowired) by looking up in the registry to find
if there is a single instance of matching t [...]
+ "engine": { "index": 6, "kind": "property", "displayName": "Engine",
"group": "advanced", "label": "advanced", "required": false, "type": "object",
"javaType": "org.apache.camel.component.platform.http.spi.PlatformHttpEngine",
"deprecated": false, "autowired": false, "secret": false, "description": "An
HTTP Server engine implementation to serve the requests" },
+ "headerFilterStrategy": { "index": 7, "kind": "property", "displayName":
"Header Filter Strategy", "group": "filter", "label": "filter", "required":
false, "type": "object", "javaType":
"org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired":
false, "secret": false, "description": "To use a custom
org.apache.camel.spi.HeaderFilterStrategy to filter header to and from Camel
message." }
},
"bodyTypes": {
"consumerOut": { "carriers": [ "stream", "bytes", "null", "map", "file" ],
"byOption": [ { "option": "useBodyHandler", "value": "false", "carriers": [
"pojo" ] } ], "description": "The request body: the stream cache with the
Vert.x engine, a byte array with Spring Boot; null for a request without a
body, such as a GET; a Map of the fields of a form (populateBodyWithForm); a
File for an upload" },
@@ -55,16 +56,17 @@
"requestTimeout": { "index": 14, "kind": "parameter", "displayName":
"Request Timeout", "group": "consumer", "label": "advanced,consumer",
"required": false, "type": "integer", "javaType": "long", "deprecated": false,
"autowired": false, "secret": false, "description": "The period in milliseconds
after which the request should be timed out." },
"returnHttpRequestHeaders": { "index": 15, "kind": "parameter",
"displayName": "Return Http Request Headers", "group": "consumer", "label":
"advanced,consumer", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether to include HTTP request headers
(Accept, User-Agent, etc.) into HTTP response produced by this endpoint." },
"stripUriPrefix": { "index": 16, "kind": "parameter", "displayName":
"Strip Uri Prefix", "group": "consumer", "label": "consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether to strip the registered consumer path from CamelHttpPath after the
request has been matched, so the exchange sees the path relative to this
consumer instead of the full raw request path. Comb [...]
- "useBodyHandler": { "index": 17, "kind": "parameter", "displayName": "Use
Body Handler", "group": "consumer", "label": "advanced,consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description":
"Whether to use BodyHandler for the request. If set to false then the request
will no be read and parsed." },
- "useCookieHandler": { "index": 18, "kind": "parameter", "displayName":
"Use Cookie Handler", "group": "consumer", "label": "advanced,consumer",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"description": "Whether to enable the Cookie Handler that allows Cookie
addition, expiry, and retrieval (currently only supported by
camel-platform-http-vertx)" },
- "useStreaming": { "index": 19, "kind": "parameter", "displayName": "Use
Streaming", "group": "consumer", "label": "advanced,consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether to use streaming for large requests and responses (currently only
supported by camel-platform-http-vertx)" },
- "bridgeErrorHandler": { "index": 20, "kind": "parameter", "displayName":
"Bridge Error Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Allows for bridging the consumer to the
Camel routing Error Handler, which mean any exceptions (if possible) occurred
while the Camel consumer is trying to pickup incoming [...]
- "exceptionHandler": { "index": 21, "kind": "parameter", "displayName":
"Exception Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.",
"deprecated": false, "autowired": false, "secret": false, "description": "To
let the consumer use a custom ExceptionHandler. Notice if the option
bridgeErrorHandler is enabled then this option is not in use. By de [...]
- "exchangePattern": { "index": 22, "kind": "parameter", "displayName":
"Exchange Pattern", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "enum", "javaType":
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ],
"deprecated": false, "autowired": false, "secret": false, "description": "Sets
the exchange pattern when the consumer creates an exchange." },
- "fileNameExtWhitelist": { "index": 23, "kind": "parameter", "displayName":
"File Name Ext Whitelist", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "A comma or whitespace separated list of file extensions.
Uploads having these extensions will be stored locally. Null value or asterisk
(*) will allow all files." },
- "unmatchedRequestHandling": { "index": 24, "kind": "parameter",
"displayName": "Unmatched Request Handling", "group": "consumer (advanced)",
"label": "consumer,advanced", "required": false, "type": "enum", "javaType":
"java.lang.String", "enum": [ "platform", "camel" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "platform", "description":
"Who answers requests that match no registered operation when using rest-dsl
contract-first (such as the rest-openap [...]
- "headerFilterStrategy": { "index": 25, "kind": "parameter", "displayName":
"Header Filter Strategy", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired":
false, "secret": false, "description": "To use a custom HeaderFilterStrategy to
filter headers to and from Camel message." },
- "platformHttpEngine": { "index": 26, "kind": "parameter", "displayName":
"Platform Http Engine", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"org.apache.camel.component.platform.http.spi.PlatformHttpEngine",
"deprecated": false, "autowired": false, "secret": false, "description": "An
HTTP Server engine implementation to serve the requests of this endpoint." },
- "oauthProfile": { "index": 27, "kind": "parameter", "displayName": "OAuth
Profile", "group": "security", "label": "consumer,security", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "OAuth profile name for
validating incoming Authorization: Bearer tokens. When set, the request is
authenticated before the route is processed. This requires an
OAuthTokenValidationFactory; camel-oauth provides [...]
+ "synchronous": { "index": 17, "kind": "parameter", "displayName":
"Synchronous", "group": "consumer", "label": "advanced,consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether the consumer routes each request synchronously. When true, the route
runs on a thread of the Vert.x worker pool, which waits until the route is
complete, so the size of the worker pool limit [...]
+ "useBodyHandler": { "index": 18, "kind": "parameter", "displayName": "Use
Body Handler", "group": "consumer", "label": "advanced,consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description":
"Whether to use BodyHandler for the request. If set to false then the request
will no be read and parsed." },
+ "useCookieHandler": { "index": 19, "kind": "parameter", "displayName":
"Use Cookie Handler", "group": "consumer", "label": "advanced,consumer",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"description": "Whether to enable the Cookie Handler that allows Cookie
addition, expiry, and retrieval (currently only supported by
camel-platform-http-vertx)" },
+ "useStreaming": { "index": 20, "kind": "parameter", "displayName": "Use
Streaming", "group": "consumer", "label": "advanced,consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether to use streaming for large requests and responses (currently only
supported by camel-platform-http-vertx)" },
+ "bridgeErrorHandler": { "index": 21, "kind": "parameter", "displayName":
"Bridge Error Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Allows for bridging the consumer to the
Camel routing Error Handler, which mean any exceptions (if possible) occurred
while the Camel consumer is trying to pickup incoming [...]
+ "exceptionHandler": { "index": 22, "kind": "parameter", "displayName":
"Exception Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.",
"deprecated": false, "autowired": false, "secret": false, "description": "To
let the consumer use a custom ExceptionHandler. Notice if the option
bridgeErrorHandler is enabled then this option is not in use. By de [...]
+ "exchangePattern": { "index": 23, "kind": "parameter", "displayName":
"Exchange Pattern", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "enum", "javaType":
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ],
"deprecated": false, "autowired": false, "secret": false, "description": "Sets
the exchange pattern when the consumer creates an exchange." },
+ "fileNameExtWhitelist": { "index": 24, "kind": "parameter", "displayName":
"File Name Ext Whitelist", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "A comma or whitespace separated list of file extensions.
Uploads having these extensions will be stored locally. Null value or asterisk
(*) will allow all files." },
+ "unmatchedRequestHandling": { "index": 25, "kind": "parameter",
"displayName": "Unmatched Request Handling", "group": "consumer (advanced)",
"label": "consumer,advanced", "required": false, "type": "enum", "javaType":
"java.lang.String", "enum": [ "platform", "camel" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "platform", "description":
"Who answers requests that match no registered operation when using rest-dsl
contract-first (such as the rest-openap [...]
+ "headerFilterStrategy": { "index": 26, "kind": "parameter", "displayName":
"Header Filter Strategy", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired":
false, "secret": false, "description": "To use a custom HeaderFilterStrategy to
filter headers to and from Camel message." },
+ "platformHttpEngine": { "index": 27, "kind": "parameter", "displayName":
"Platform Http Engine", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"org.apache.camel.component.platform.http.spi.PlatformHttpEngine",
"deprecated": false, "autowired": false, "secret": false, "description": "An
HTTP Server engine implementation to serve the requests of this endpoint." },
+ "oauthProfile": { "index": 28, "kind": "parameter", "displayName": "OAuth
Profile", "group": "security", "label": "consumer,security", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "OAuth profile name for
validating incoming Authorization: Bearer tokens. When set, the request is
authenticated before the route is processed. This requires an
OAuthTokenValidationFactory; camel-oauth provides [...]
}
}
diff --git
a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpComponent.java
b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpComponent.java
index 3840abbb13fe..acc68261716c 100644
---
a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpComponent.java
+++
b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpComponent.java
@@ -65,6 +65,14 @@ public class PlatformHttpComponent extends
HeaderFilterStrategyComponent
@Metadata(label = "advanced,consumer",
description = "The period in milliseconds after which the
request should be timed out.")
private long requestTimeout;
+ @Metadata(label = "advanced,consumer", defaultValue = "false",
+ description = "Whether the consumers route each request
synchronously, as the default for the endpoints of this"
+ + " component. When true, the route runs on a
thread of the Vert.x worker pool, which waits until the"
+ + " route is complete, so the size of the worker
pool limits how many requests are routed at the same"
+ + " time. When false, the worker thread is free as
soon as the route continues on another thread"
+ + " (such as an asynchronous producer). See the
synchronous endpoint option."
+ + " (currently only supported by
camel-platform-http-vertx)")
+ private boolean synchronous;
@Metadata(label = "advanced,consumer", defaultValue = "true",
description = "Whether HTTP server should do preliminary
validation of incoming requests, validating if Content-Type/Accept header,
matches what"
+ " is allowed according to consumes/produces
configuration (if set). If validation fails HTTP Status 415/406 is returned."
@@ -92,6 +100,7 @@ public class PlatformHttpComponent extends
HeaderFilterStrategyComponent
endpoint.setPlatformHttpEngine(engine);
endpoint.setHandleWriteResponseError(handleWriteResponseError);
endpoint.setRequestTimeout(requestTimeout);
+ endpoint.setSynchronous(synchronous);
setEndpointHeaderFilterStrategy(endpoint);
setProperties(endpoint, parameters);
return endpoint;
@@ -297,6 +306,14 @@ public class PlatformHttpComponent extends
HeaderFilterStrategyComponent
this.requestTimeout = requestTimeout;
}
+ public boolean isSynchronous() {
+ return synchronous;
+ }
+
+ public void setSynchronous(boolean synchronous) {
+ this.synchronous = synchronous;
+ }
+
public boolean isServerRequestValidation() {
return serverRequestValidation;
}
diff --git
a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java
b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java
index 2227077b50dd..5e92cd9a65c4 100644
---
a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java
+++
b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java
@@ -179,6 +179,17 @@ public class PlatformHttpEndpoint extends DefaultEndpoint
@UriParam(label = "advanced,consumer",
description = "The period in milliseconds after which the
request should be timed out.")
private long requestTimeout;
+ @UriParam(label = "advanced,consumer", defaultValue = "false",
+ description = "Whether the consumer routes each request
synchronously. When true, the route runs on a thread of the"
+ + " Vert.x worker pool, which waits until the
route is complete, so the size of the worker pool limits"
+ + " how many requests are routed at the same time.
When false, the route starts on a worker thread"
+ + " with the asynchronous routing engine, and the
worker thread is free as soon as the route continues"
+ + " on another thread (such as an asynchronous
producer), so the worker pool no longer limits the"
+ + " requests in flight. Keep it false for a route
that calls an asynchronous producer using the same"
+ + " Vert.x as the HTTP server (such as vertx-http
in Camel Quarkus): with true, such requests can"
+ + " occupy every worker thread while their
producers need a worker thread to complete, and then no"
+ + " request completes. (currently only supported
by camel-platform-http-vertx)")
+ private boolean synchronous;
@UriParam(label = "consumer,security", displayName = "OAuth Profile",
description = "OAuth profile name for validating incoming
Authorization: Bearer tokens. "
+ "When set, the request is authenticated before
the route is processed. "
@@ -440,6 +451,14 @@ public class PlatformHttpEndpoint extends DefaultEndpoint
this.requestTimeout = requestTimeout;
}
+ public boolean isSynchronous() {
+ return synchronous;
+ }
+
+ public void setSynchronous(boolean synchronous) {
+ this.synchronous = synchronous;
+ }
+
public String getOauthProfile() {
return oauthProfile;
}
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
index 4282ad2f1c6d..42eb192a0e55 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
@@ -1097,6 +1097,24 @@ read. A custom `httpBinding` set on the component is now
used by the Rest DSL co
`ServletRestHttpBinding`. Any other binding set on the component is still used
only by `servlet:` routes, as it does
not map the path placeholders such as `+{id}+` to headers.
+=== camel-platform-http-vertx - a route with an asynchronous step no longer
holds a worker thread
+
+A `platform-http` route with an asynchronous step, such as a `vertx-http`
call, no longer holds a Vert.x worker thread
+while it waits for that step. So the size of the worker pool no longer limits
how many requests of such a route are in
+flight at the same time. A route that is synchronous to its end runs as before.
+
+This is the default (`false`) of the new `synchronous` option of the
`platform-http` endpoint and component. It is the
+default because a route that calls an asynchronous producer on the same Vert.x
as the HTTP server (such as `vertx-http`
+in Camel Quarkus, or with a Vert.x instance in the registry) could otherwise
stop answering for good once there were as
+many requests in flight as worker threads. Camel 3.x up to 4.1 also routed
this way; from Camel 4.2 to 4.23 the
+worker thread waited until the route was complete.
+
+To keep the behaviour of Camel 4.2 to 4.23, where the worker thread waits
until the route is complete and the worker
+pool bounds the requests in flight, set `synchronous=true` on the endpoint, or
+`camel.component.platform-http.synchronous=true` for all of them. A route that
stays in the asynchronous mode and needs
+a bound sets one itself, for example with
`throttle(n).concurrentRequestsMode().asyncDelayed()`: with `asyncDelayed`, a
+request that waits for a permit does not hold a worker thread either.
+
=== camel-http - authMethod=Bearer and authMethod=NTLM are applied
The endpoint options `authMethod=Bearer` and `authBearerToken` now send the
token when the server asks for it. Before,
diff --git
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/PlatformHttpComponentBuilderFactory.java
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/PlatformHttpComponentBuilderFactory.java
index f981332b2d0b..8470b2bfa36f 100644
---
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/PlatformHttpComponentBuilderFactory.java
+++
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/PlatformHttpComponentBuilderFactory.java
@@ -142,6 +142,30 @@ public interface PlatformHttpComponentBuilderFactory {
}
+ /**
+ * Whether the consumers route each request synchronously, as the
+ * default for the endpoints of this component. When true, the route
+ * runs on a thread of the Vert.x worker pool, which waits until the
+ * route is complete, so the size of the worker pool limits how many
+ * requests are routed at the same time. When false, the worker thread
+ * is free as soon as the route continues on another thread (such as an
+ * asynchronous producer). See the synchronous endpoint option.
+ * (currently only supported by camel-platform-http-vertx).
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: consumer
+ *
+ * @param synchronous the value to set
+ * @return the dsl builder
+ */
+ default PlatformHttpComponentBuilder synchronous(boolean synchronous) {
+ doSetProperty("synchronous", synchronous);
+ return this;
+ }
+
+
/**
* Whether autowiring is enabled. This is used for automatic autowiring
* options (the option must be marked as autowired) by looking up in
the
@@ -215,6 +239,7 @@ public interface PlatformHttpComponentBuilderFactory {
case "handleWriteResponseError": ((PlatformHttpComponent)
component).setHandleWriteResponseError((boolean) value); return true;
case "requestTimeout": ((PlatformHttpComponent)
component).setRequestTimeout((long) value); return true;
case "serverRequestValidation": ((PlatformHttpComponent)
component).setServerRequestValidation((boolean) value); return true;
+ case "synchronous": ((PlatformHttpComponent)
component).setSynchronous((boolean) value); return true;
case "autowiredEnabled": ((PlatformHttpComponent)
component).setAutowiredEnabled((boolean) value); return true;
case "engine": ((PlatformHttpComponent)
component).setEngine((org.apache.camel.component.platform.http.spi.PlatformHttpEngine)
value); return true;
case "headerFilterStrategy": ((PlatformHttpComponent)
component).setHeaderFilterStrategy((org.apache.camel.spi.HeaderFilterStrategy)
value); return true;
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PlatformHttpEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PlatformHttpEndpointBuilderFactory.java
index 5ab6bc189e33..5045c821b1d3 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PlatformHttpEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PlatformHttpEndpointBuilderFactory.java
@@ -526,6 +526,60 @@ public interface PlatformHttpEndpointBuilderFactory {
doSetProperty("returnHttpRequestHeaders",
returnHttpRequestHeaders);
return this;
}
+ /**
+ * Whether the consumer routes each request synchronously. When true,
+ * the route runs on a thread of the Vert.x worker pool, which waits
+ * until the route is complete, so the size of the worker pool limits
+ * how many requests are routed at the same time. When false, the route
+ * starts on a worker thread with the asynchronous routing engine, and
+ * the worker thread is free as soon as the route continues on another
+ * thread (such as an asynchronous producer), so the worker pool no
+ * longer limits the requests in flight. Keep it false for a route that
+ * calls an asynchronous producer using the same Vert.x as the HTTP
+ * server (such as vertx-http in Camel Quarkus): with true, such
+ * requests can occupy every worker thread while their producers need a
+ * worker thread to complete, and then no request completes. (currently
+ * only supported by camel-platform-http-vertx).
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: consumer
+ *
+ * @param synchronous the value to set
+ * @return the dsl builder
+ */
+ default AdvancedPlatformHttpEndpointBuilder synchronous(boolean
synchronous) {
+ doSetProperty("synchronous", synchronous);
+ return this;
+ }
+ /**
+ * Whether the consumer routes each request synchronously. When true,
+ * the route runs on a thread of the Vert.x worker pool, which waits
+ * until the route is complete, so the size of the worker pool limits
+ * how many requests are routed at the same time. When false, the route
+ * starts on a worker thread with the asynchronous routing engine, and
+ * the worker thread is free as soon as the route continues on another
+ * thread (such as an asynchronous producer), so the worker pool no
+ * longer limits the requests in flight. Keep it false for a route that
+ * calls an asynchronous producer using the same Vert.x as the HTTP
+ * server (such as vertx-http in Camel Quarkus): with true, such
+ * requests can occupy every worker thread while their producers need a
+ * worker thread to complete, and then no request completes. (currently
+ * only supported by camel-platform-http-vertx).
+ *
+ * The option will be converted to a <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: consumer
+ *
+ * @param synchronous the value to set
+ * @return the dsl builder
+ */
+ default AdvancedPlatformHttpEndpointBuilder synchronous(String
synchronous) {
+ doSetProperty("synchronous", synchronous);
+ return this;
+ }
/**
* Whether to use BodyHandler for the request. If set to false then the
* request will no be read and parsed.