Claus Ibsen created CAMEL-27939:
-----------------------------------

             Summary: camel-nats: InOut requests time out after 
requestCleanupInterval instead of requestTimeout
                 Key: CAMEL-27939
                 URL: https://issues.apache.org/jira/browse/CAMEL-27939
             Project: Camel
          Issue Type: Bug
          Components: camel-nats
            Reporter: Claus Ibsen
             Fix For: 4.25.0


Found while improving the option descriptions of camel-nats for CAMEL-23832 
(pull request https://github.com/apache/camel/pull/31191).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. InOut requests ignore requestTimeout
{{NatsProducer.process}} (InOut) calls connection.request(Message) without a 
timeout. In jnats 2.26 the request then gets requestCleanupInterval as its 
timeout, and the cleanup timer cancels it 1 to 2 intervals after it was sent, 
so with the defaults (requestTimeout=20000, requestCleanupInterval=5000) a 
request fails after 5 to 10 s with a CancellationException, never after 20 s 
and never with ExchangeTimedOutException. The descriptions now document this.
Proposed change: call connection.requestWithTimeout(message, 
Duration.ofMillis(requestTimeout)).

h4. 2. The effective ack policy is not used
{{NatsConsumer.CamelNatsMessageHandler}} and the start WARNs read 
configuration.getAckPolicy() instead of the policy of the effective 
ConsumerConfiguration, so with a consumerConfiguration with AckPolicy.None a 
failed exchange gets a nak.
Proposed change: use cc.getAckPolicy().

h4. 3. durableName="" creates a durable named "-durable"
{{NatsConsumer.setupJetStreamConsumer}} checks durableName != null for the 
builder but isNotEmpty for the log line.
Proposed change: use ObjectHelper.isNotEmpty in both places.

h4. 4. Smaller issues
jetstreamAsync=true calls publishAsync and then blocks on future.get right 
away, so it is not faster than the sync publish (make it truly async, or 
deprecate it); it is labelled advanced but only the producer uses it. 
maxMessages is a String option holding an integer. maxReconnectAttempts, 
pingInterval, verbose, noRandomizeServers and noEcho have no label. poolSize 
defaults to 10 but only one task runs on the pool. With jetstreamEnabled=true 
on a server without JetStream the consumer falls back to core NATS without a 
WARN.


_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to