gnodet-bot commented on code in PR #31133:
URL: https://github.com/apache/camel/pull/31133#discussion_r4744752847
##########
components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusConfiguration.java:
##########
@@ -97,6 +97,11 @@ public class ServiceBusConfiguration implements Cloneable,
HeaderFilterStrategyA
@UriParam(label = "consumer", defaultValue = "1",
description = "Sets the maximum number of concurrent sessions to
process at any given time. Only applies when sessionEnabled is true.")
private int maxConcurrentSessions = 1;
+ @UriParam(label = "consumer", javaType = "java.time.Duration",
Review Comment:
⚠️ **Missing `defaultValue` in `@UriParam`** — the annotation does not
declare `defaultValue="-1"`, so the generated endpoint catalog will show no
default value for `sessionIdleTimeout`. Compare `maxAutoLockRenewDuration`
which has `defaultValue="300000"`. Without it, users browsing the docs see the
field as having no default, with no hint that `-1` means "use SDK default (1
minute)".
The description also says *"When not set the SDK default is used"* — but
this is a primitive `long`, it is always "set". The description should
explicitly state the sentinel:
```suggestion
@UriParam(label = "consumer", javaType = "java.time.Duration",
defaultValue = "-1",
description = "Sets the amount of time (millis) to wait for
the next message in a session-enabled consumer "
+ "before closing the session and trying to
acquire a new session. "
+ "Applies only when sessionEnabled=true. Set to
-1 (default) to use the SDK default (1 minute).")
```
##########
components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/client/ServiceBusClientFactory.java:
##########
@@ -165,7 +165,13 @@ public ServiceBusProcessorClient
createServiceBusSessionProcessorClient(
.prefetchCount(configuration.getPrefetchCount())
.subQueue(configuration.getSubQueue())
.maxConcurrentCalls(configuration.getMaxConcurrentCalls())
-
.maxConcurrentSessions(configuration.getMaxConcurrentSessions())
+
.maxConcurrentSessions(configuration.getMaxConcurrentSessions());
+
+ if (configuration.getSessionIdleTimeout() >= 0) {
+
clientBuilder.sessionIdleTimeout(Duration.ofMillis(configuration.getSessionIdleTimeout()));
Review Comment:
⚠️ **No test verifies the `sessionIdleTimeout` wiring** — this PR removes
all `SessionLockRenewer` tests and adds a new configuration parameter with no
test coverage. There is no test that:
1. Verifies a positive `sessionIdleTimeout` value calls
`clientBuilder.sessionIdleTimeout(Duration.ofMillis(N))` on the session
processor builder
2. Verifies the `-1` default **skips** the call (using the SDK default)
3. Verifies URI parsing:
`azure-servicebus:queue?sessionEnabled=true&sessionIdleTimeout=300000`
The existing `ServiceBusConsumerDstTest` or a new unit test for
`ServiceBusClientFactory` could cover scenarios 1 and 2 by mocking the builder
and asserting `sessionIdleTimeout()` is or is not called. This is essential —
without it, a future refactor of the `-1` guard would silently break the
feature.
--
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]