-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kafka OAUTHBEARER: Could not produce message to multiple Event hub namespaces in one application #200
Comments
Can you run the original sample for both namespaces separately? This way you can identify if there is any RBAC issues. |
Hi @serkantkaraca , Yes, I did as you said and mentioned it in the original post:
|
I will try to reproduce this and update the thread with my findings. |
Issue seems to be related to Executors. Can you remove the executor and move the produce code into a static function? |
Hi @serkantkaraca , In the real business, I would think one application should be capable of producing/consuming messages to/from multiple namespaces in parallel, not sequentially.
Error here:
I guess the CustomAuthenticateCallbackHandler can handle only 1 request from 1 namespace very slowly before being available again for the next request from another different namespace. |
Timing of the logs are not adding up. How is the failure for autoeventhubtesting making before "#auto" log line? Can you wait until the messages are flushed? |
Hi @serkantkaraca , You can reproduce the issue easily by using my main() in the previous comment, to debug where the failure's from. It seems the "producer_auto" could not be created right after creating "producer" successfully --> caused the exception before "#auto" log line. By the way, if you already had a sample to consume/produce messages from/to multiple namespaces in ONE application successfullly, could you please share it? Thank you! |
I was able to identify the issue. Kafka library doesn't allow creating multiple login managers when the callback handler is shared across different namespaces. I was able to solve the issue by creating 2 different handlers like CustomAuthenticateCallbackHandler1 and CustomAuthenticateCallbackHandler2. Below is the Kafka code that causes the issue. Once it creates the first loginManager for the first broker, it skips for the second broker. |
Hi @serkantkaraca , Thanks for your analysis!
Could you provide a generic solution for that? A sample code would be greatly appreciated! Thanks for your support! |
Description
Kafka OAUTHBEARER: Could not produce message to multiple Event hub namespaces in one application
How to reproduce
Hi experts,
I am using this sample: https://github.com/Azure/azure-event-hubs-for-kafka/tree/master/tutorials/oauth/java/appsecret
I made some minor modifications in TestProducer class: add line 18:
executorService.execute(new TestDataReporter(producer_auto, TOPIC));
and line 26:
properties.load(new FileReader("src/main/resources/producer_auto.config"));
Purpose: I want to produce message to 2 different EVENT HUB namespaces (means creating 2 diffrent Kafka Producers for 2 bootstrap servers) in ONE console application, see full code:
Here is producer.config:
and producer_auto.config:
When I execute the code, the application can produce message to just the first namespace (advantcoeventhubs), and throw exception when produce message to the second namespace (autoeventhubtesting): "ERROR NetworkClient [Producer clientId=KafkaExampleProducer] Connection to node -1 (autoeventhubtesting.servicebus.windows.net/13.66.138.74:9093) failed authentication due to: Invalid SASL mechanism response, server may be expecting a different protocol"
Please see attached picture for error here: Invalid SASL mechanism response, server may be expecting a different protocol
All event hub namespaces are in Standard tier already. Can any experts advise the root cause and work around solution?
Thank you so much!
Has it worked previously?
It was working successfully when we used 1 separated application to produce message to 1 event hub namespace.
The issue only happens when we use ONE application to produce message to 2 different event hub namespaces.
The text was updated successfully, but these errors were encountered: