Hi All, I already have an app implemented in Java that creates a kafka producer and consumer to connect to kafka. It is working fine. I have even run it with PLAIN and SHA256 authentication. Worked perfectly fine.
Now, I have configured it to use oauthbearer. Suddenly , kafka producer does not come up. Here is the line of code where we create a kafka producer: *Properties props;* *KafkaProducer producer = new KafkaProducer<String, String>(props); * This line is the problem. I set a breakpoint here and then tried to enter inside the KafkaProducer function. (This is of no use as I don't have the source code for that in my IDE). But doing so introduces some delay. And when I exit that and return to the main code, everything works fine. Kafka producer comes up and I can even produce and consume, etc. But if I don't do the above, producer creation fails. What I suspect is: inside the kafkaproducer function, we are trying to contact the *OAuth2 server* and somehow we are getting out of the function before we get and process the response from the OAuth2 server. That is why when we set a breakpoint, things work fine. Else it fails. Please suggest any solutions to fix this. I tried the following already, but didn't work: props.put("sasl.login.read.timeout.ms", 100000); props.put("sasl.login.connect.timeout.ms", 100000); Note: 1. I know that the code itself works. As mentioned above, this is code that has been there for a while. Also, for reasons mentioned above, even the changes to support OAuth2 work if I artificially create a delay by entering the KafkaProducer constructor from the kafka client jar. 2. I also have confirmed that the oauth2 server is good and is accessible from that machine. I am able to bring up the kafka console producer/consumer and run tests. Works perfectly fine. The configuration I am using in my Java code is the same as what I have in my console producer/consumer. 3. For some reason, the kafka consumer that has a similar code as the producer works perfectly fine too. Only producer has the above mentioned problem. Thanks in advance, Iyer