allthingssecurity commented on PR #30468:
URL: https://github.com/apache/camel/pull/30468#issuecomment-7036362020

   Thanks Claus, done in 4314ba230ea8.
   
   **Option**: `synchronous` on the `platform-http` endpoint, and on the 
component as the default for its endpoints (copied in `createEndpoint`, like 
`requestTimeout`).
   - `synchronous=true`: the synchronous processor in `executeBlocking`, as on 
main. The worker thread waits until the route is complete, so the worker pool 
bounds the requests in flight.
   - `synchronous=false`: the asynchronous processor of this PR.
   
   I put it on the endpoint because platform-http already has Vert.x-only 
consumer options there (`useStreaming`, `useCookieHandler`), and it can then be 
set per route or for the whole app 
(`camel.component.platform-http.synchronous=true`). 
`VertxPlatformHttpServerConfiguration` would not reach Camel Quarkus: its 
recorder creates the `VertxPlatformHttpRouter` with no 
`VertxPlatformHttpServer`, on the Quarkus Vert.x. Camel Quarkus is where the 
shared Vert.x case comes from.
   
   **Default**: `false`. With `true`, a route that calls an async producer on 
the same Vert.x can stop answering for good. With `false`, only routes that 
have an asynchronous step lose the bound. Camel 3.6 to 4.1 also routed this 
way. The blocking call came in 4.2 with CAMEL-20011, which moved the consumer 
off the deprecated `executeBlocking(Handler<Promise>)`. If you prefer `true` as 
the default, it is a one-line change plus the guide entry, and I can switch it.
   
   About the quick routes: a route that is synchronous to its end runs the same 
in both modes. It runs on the worker thread with no hand-over, and the response 
is written on the context of the request. The bound on in-flight requests is 
the real difference.
   
   **Docs**: a new section "Synchronous or asynchronous routing" in 
`platform-http-vertx.adoc` covers:
   - when to choose each mode (a shared Vert.x with vertx-http, versus relying 
on the worker pool as the limit);
   - an example;
   - the component-wide setting.
   
   The 4.24 upgrade-guide entry says the default, why, and how to keep the 4.2 
to 4.23 behaviour. For a bound in the asynchronous mode it now gives 
`throttle(n).concurrentRequestsMode().asyncDelayed()`. Without `asyncDelayed`, 
the waiting requests hold the worker threads again and hang on a shared Vert.x: 
a scratch test answered 0 of 4 without it and 4 of 4 with it. So I replaced the 
plain "Throttle EIP" advice from the first commit.
   
   **Tests**: `VertxPlatformHttpSynchronousTest`, next to 
`VertxPlatformHttpSharedVertxWorkerPoolTest`. It uses 2 worker threads, 4 
requests, and a route whose async step completes later on the test thread.
   - `synchronous=true` (endpoint option or component option): only 2 requests 
reach the step until some complete.
   - `synchronous=false`: all 4 reach it, also when the endpoint sets `false` 
over a component `true`.
   - `VertxPlatformHttpSharedVertxWorkerPoolTest` now runs with the default and 
with `synchronous=false`.
   
   Checks I ran:
   - Consumer changed to ignore the option: the two `true` tests fail. Consumer 
always synchronous: the four `false` tests fail.
   - Module tests: camel-platform-http-vertx 182 run, 0 failures, 1 skipped; 
camel-platform-http 44 run, 0 failures, 1 skipped.
   - Both classes 20 times in one JVM: 120 run, 0 failures.
   
   **Generated**: I regenerated these with camel-package-maven-plugin:
   - the configurers, the uri factory and `platform-http.json`;
   - the catalog copies of the JSON and of the component doc;
   - the endpoint and component DSL.
   
   The PR description is updated.
   
   _Claude Code on behalf of allthingssecurity_
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to