You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
topic = "MSKTutorialTopic"
while True:
try:
inp = input(">")
producer.send(topic, inp.encode())
producer.flush()
print("Produced!")
except Exception as e:
print("Failed to send message:", e)
producer.close()
Description
I try to connect MSK in cn-north-1, I don't know why they throw an error like this.even didn't print debug info
What I Did
Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.
Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.
Traceback (most recent call last):
File "C:\Users\ec3\Desktop\新建文件夹\potplayer_translate_plug_in\ddd.py", line 17, in
producer = KafkaProducer(
^^^^^^^^^^^^^^
File "C:\Users\ec3\miniconda\Lib\site-packages\kafka\producer\kafka.py", line 381, in init
client = KafkaClient(metrics=self._metrics, metric_group_prefix='producer',
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ec3\miniconda\Lib\site-packages\kafka\client_async.py", line 244, in init
self.config['api_version'] = self.check_version(timeout=check_timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ec3\miniconda\Lib\site-packages\kafka\client_async.py", line 927, in check_version
raise Errors.NoBrokersAvailable()
kafka.errors.NoBrokersAvailable: NoBrokersAvailable
The text was updated successfully, but these errors were encountered:
Xu-Hardy
changed the title
kafka.errors.NoBrokersAvailable: NoBrokersAvailable
kafka.errors.NoBrokersAvailable: NoBrokersAvailable in manged MSK in china region
Dec 22, 2023
Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
from kafka import KafkaProducer
from kafka.errors import KafkaError
import socket
import time
from aws_msk_iam_sasl_signer import MSKAuthTokenProvider
class MSKTokenProvider():
def token(self):
token, _ = MSKAuthTokenProvider.generate_auth_token("cn-north-1", aws_debug_creds=True)
print("token", token)
return token
tp = MSKTokenProvider()
producer = KafkaProducer(
bootstrap_servers='b-2..zwc7ax.c4.kafka.cn-north-1.amazonaws.com.cn:9098,'
security_protocol='SASL_SSL',
sasl_mechanism='OAUTHBEARER',
sasl_oauth_token_provider=tp,
client_id=socket.gethostname(),
)
topic = "MSKTutorialTopic"
while True:
try:
inp = input(">")
producer.send(topic, inp.encode())
producer.flush()
print("Produced!")
except Exception as e:
print("Failed to send message:", e)
producer.close()
Description
I try to connect MSK in cn-north-1, I don't know why they throw an error like this.even didn't print debug info
What I Did
Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.
Traceback (most recent call last):
File "C:\Users\ec3\Desktop\新建文件夹\potplayer_translate_plug_in\ddd.py", line 17, in
producer = KafkaProducer(
^^^^^^^^^^^^^^
File "C:\Users\ec3\miniconda\Lib\site-packages\kafka\producer\kafka.py", line 381, in init
client = KafkaClient(metrics=self._metrics, metric_group_prefix='producer',
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ec3\miniconda\Lib\site-packages\kafka\client_async.py", line 244, in init
self.config['api_version'] = self.check_version(timeout=check_timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ec3\miniconda\Lib\site-packages\kafka\client_async.py", line 927, in check_version
raise Errors.NoBrokersAvailable()
kafka.errors.NoBrokersAvailable: NoBrokersAvailable
The text was updated successfully, but these errors were encountered: