Claus Ibsen created CAMEL-27692:
-----------------------------------

             Summary: camel-rocketmq: reply consumer ignores ACL/namespace, NPE 
on keyless reply, labels and enums
                 Key: CAMEL-27692
                 URL: https://issues.apache.org/jira/browse/CAMEL-27692
             Project: Camel
          Issue Type: Bug
          Components: camel-rocketmq
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while improving the option descriptions of camel-rocketmq for CAMEL-23832 
(commit 
https://github.com/apache/camel/commit/d8de0e65c7cdeef2144cf0276176c35d31431fc5).
These are separate problems of the component; the descriptions commit only 
documents the current behavior.

h4. 1. The consumer of replyToTopic ignores the ACL credentials, namespace, 
accessChannel and enableTrace
{{RocketMQReplyManagerSupport.createConsumer()}} creates a 
{{DefaultMQPushConsumer}} and sets only the consumer group 
({{replyToConsumerGroup}}) and {{namesrvAddr}}. The producer and the consumer 
({{RocketMQProducer.doStart()}}, {{RocketMQConsumer.startConsumer()}}) also 
pass the ACL RPC hook of {{accessKey}}/{{secretKey}} and set {{namespace}}, 
{{accessChannel}} and {{enableTrace}}.
With a broker that needs ACL credentials, or a namespaced (for example 
serverless) instance, the InOut request is sent but the reply cannot be 
received, and the exchange fails with an {{ExchangeTimedOutException}}.
Proposed change: create the reply consumer with 
{{RocketMQAclUtils.getAclRPCHook(...)}} and set the same namespace, access 
channel and trace settings as the producer.

h4. 2. A message without keys on replyToTopic is redelivered instead of ignored
{{RocketMQReplyManagerSupport.onMessage()}} calls 
{{messageExt.getKeys().split(MessageConst.KEY_SEPARATOR)}} without a null 
check. For a message on the reply topic that has no keys, the listener throws a 
{{NullPointerException}}; the RocketMQ client 
({{ConsumeMessageConcurrentlyService}}) treats this as {{RECONSUME_LATER}}, so 
the message is delivered again up to the maximum reconsume times (16 by 
default) and logged each time.
Proposed change: treat null keys like keys without a generated message key: log 
and ignore the message ({{CONSUME_SUCCESS}}).

h4. 3. Component options accessKey and secretKey have the label secret
On {{RocketMQComponent}} the {{@Metadata}} of {{accessKey}} and {{secretKey}} 
has {{label = "secret"}}; the endpoint options have {{label = "security"}}, as 
other components do.
Proposed change: use {{label = "security"}} on the component options.

h4. 4. Component option sendTag has the label common
{{RocketMQComponent.sendTag}} has {{label = "common"}}, the endpoint option 
{{label = "producer"}}. Only the producer uses it.
Proposed change: use {{label = "producer"}} on the component option.

h4. 5. Component options messageSelectorType and accessChannel have no enums
The endpoint options have {{enums = "tag,sql"}} and {{enums = "LOCAL,CLOUD"}}; 
the {{@Metadata}} of the component options has none, so tooling does not offer 
or check the values.
Proposed change: add the same enums to the component options.

h4. 6. requestTimeoutMillis and requestTimeoutCheckerIntervalMillis are not 
labelled producer
Both options have only {{label = "advanced"}} on the endpoint and the 
component, while only the producer uses them (InOut with replyToTopic).
Proposed change: use {{label = "producer,advanced"}}.

h4. 7. Message headers are labelled consumer only, but the producer sets them 
on InOut replies
All headers of {{RocketMQConstants}} that the message converter sets 
({{CamelRocketMQTopic}}, {{CamelRocketMQTag}}, {{CamelRocketMQKey}}, 
{{CamelRocketMQMsgId}}, ...) have {{label = "consumer"}}. 
{{RocketMQReplyManagerSupport.processReceivedReply()}} also sets them on the 
message of an InOut exchange when the reply arrives.
Proposed change: use {{label = "consumer,producer"}} for these headers.

_Claude Code on behalf of davsclaus_



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

Reply via email to