BewareMyPower opened a new issue, #184:
URL: https://github.com/apache/pulsar-client-cpp/issues/184

   ### Search before asking
   
   - [X] I searched in the 
[issues](https://github.com/apache/pulsar-client-cpp/issues) and found nothing 
similar.
   
   
   ### Version
   
   - Broker: Pulsar 2.9.3.16 (StreamNative's release)
   - Client: Pulsar C++ Client 3.1.1
   - OS: Windows 11 (Visual Studio 2019) and Ubuntu 20.04 WSL (GCC 9)
   
   ### Minimal reproduce step
   
   Set up an account on StreamNative cloud, create the topic `my-topic` in 
advance and grant the produce permission. The following example uses 
`test-auth` instance under the `sndev` cluster, replace `YOUR-KEY-FILE-PATH` to 
the path of the credential file.
   
   ```c++
   #include <pulsar/Client.h>
   using namespace pulsar;
   
   int main(int argc, char *argv[]) {
     std::string params = R"({
       "issuer_url": "https://auth.streamnative.cloud/";,
       "private_key": "YOUR-KEY-FILE-PATH",
       "audience": "urn:sn:pulsar:sndev:test-auth"})";
     ClientConfiguration config;
     config.setAuth(AuthOauth2::create(params));
     Client client("pulsar+ssl://test-auth.sndev.snio.cloud:6651", config);
   
     Producer producer;
     auto result =
         client.createProducer("persistent://public/default/my-topic", 
producer);
     if (result != ResultOk) {
       std::cerr << "Failed to create producer: " << result << std::endl;
       return 1;
     }
   
     MessageId id;
     result = producer.send(MessageBuilder().setContent("hello").build(), id);
     if (result == ResultOk) {
       std::cout << "Sent to " << id << std::endl;
     } else {
       std::cerr << "Failed to send: " << result << std::endl;
     }
   
     client.close();
     return 0;
   }
   ```
   
   ### What did you expect to see?
   
   It should succeed
   
   ### What did you see instead?
   
   Ubuntu:
   
   ```
   2023-02-01 22:58:13.267 DEBUG [139889604585216] ClientConnection:591 | 
[<none> -> pulsar+ssl://test-auth.sndev.snio.cloud:6651] Resolved hostname 
test-auth.sndev.snio.cloud to SECRET_IP:6651
   2023-02-01 22:58:14.564 INFO  [139889604585216] ClientConnection:387 | 
[MY_LOCAL_IP:38550 -> SECRET_IP:6651] Connected to broker
   2023-02-01 22:58:15.378 ERROR [139889604585216] ClientConnection:497 | 
[MY_LOCAL_IP:38550 -> SECRET_IP:6651] Failed to establish connection: 
AuthenticationError
   2023-02-01 22:58:15.378 ERROR [139889604585216] ClientConnection:1646 | 
[MY_LOCAL_IP:38550 -> SECRET_IP:6651] Connection closed with AuthenticationError
   ```
   
   Windows:
   
   ```
   
   2023-02-01 23:05:55.508 ERROR [11216] 
D:\a\pulsar-client-cpp\pulsar-client-cpp\lib\ClientConnection:497 | 
[MY_LOCAL_IP:6224 -> SECRET_IP:6651] Handshake failed: unregistered scheme 
(STORE routines)
   2023-02-01 23:05:55.508 INFO  [11216] 
D:\a\pulsar-client-cpp\pulsar-client-cpp\lib\ClientConnection:1646 | 
[MY_LOCAL_IP:6224 -> SECRET_IP:6651] Connection closed with ConnectError
   ```
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [X] I'm willing to submit a PR!


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