lizhimins opened a new issue, #1509:
URL: https://github.com/apache/rocketmq-clients/issues/1509

   ### Programming Language of the Client
   
   C++
   
   ### Runtime Platform Environment
   
   OS: Linux x86_64 (kernel 5.10)
   
   ### RocketMQ Version of the Client/Server
   
   Client: C++ SDK `master` (CMake project version 5.1.0), commit 4046e799
   Server: Apache RocketMQ 5.5.1 (gRPC v2 proxy)
   
   ### Describe the Bug
   
   `FifoProducerBuilder::withConfiguration` does not propagate the 
configuration's
   resource namespace to the underlying `ProducerImpl`. As a result, a FIFO 
producer
   built from a `Configuration` that carries a resource namespace never sends 
the
   `x-mq-namespace` request header.
   
   On a namespaced instance (e.g. a serverless / multi-tenant instance whose 
topics
   and groups are mapped to a per-instance namespace), the proxy resolves the
   instance from that header. Without it, the proxy falls back to its own 
configured
   instance, so the credentials supplied for the target instance are looked up
   against the wrong instance and authentication fails with
   `UNAUTHORIZED: User:<AccessKey> is not found`.
   
   The regular `ProducerBuilder::withConfiguration` already forwards the 
namespace
   (`cpp/source/rocketmq/Producer.cpp`), so normal producers work while FIFO
   producers fail on the very same configuration. This is an inconsistency 
between
   the two builders.
   
   ### Steps to Reproduce
   
   1. Build a `Configuration` with endpoints, a credentials provider whose
      AccessKey/SecretKey belong to a namespaced instance, and a non-empty
      `resourceNamespace`.
   2. Build a FIFO producer:
      
`FifoProducer::newBuilder().withConfiguration(cfg).withTopics({...}).withConcurrency(n).build()`.
   3. Send a FIFO message to a topic that exists on that namespaced instance.
   
   ### What Did You Expect to See?
   
   The FIFO producer sends the `x-mq-namespace` header (like the normal producer
   does), the proxy resolves the correct instance, and the message is accepted.
   
   ### What Did You See Instead?
   
   The send fails with `UNAUTHORIZED: User:<AccessKey> is not found`, because 
the
   namespace header is missing and the proxy authenticates against the wrong
   instance.
   
   ### Additional Context
   
   Fix: mirror `ProducerBuilder::withConfiguration` by adding
   `producer_impl_->withResourceNamespace(configuration.resourceNamespace());`
   in `FifoProducerBuilder::withConfiguration`
   (`cpp/source/rocketmq/FifoProducer.cpp`).
   
   Verified against a 5.5.1 gRPC proxy with per-instance namespace mapping: 
after
   the fix, FIFO / delay / transaction producers all authenticate and send
   successfully using the same namespaced configuration.


-- 
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