Quantcast
Channel: Service Bus forum
Viewing all articles
Browse latest Browse all 1916

Azure Event Hub - Unable to open authentication session on connection while sending data

$
0
0

Hi,

I was trying to send data to my azure event hub using python code sample provided in the tutorial. 


import logging
import time
from azure.eventhub import EventHubClient, EventData

logger = logging.getLogger("azure")


ADDRESS = "amqps://myeventhubnamespace.servicebus.windows.net/myeventhubname"
USER = "RootManageSharedAccessKey"
KEY = "mykey******"

try:
if not ADDRESS:
raise ValueError("amqps://myeventhubnamespace.servicebus.windows.net/myeventhubname")

client = EventHubClient(ADDRESS, debug=False, username=USER, password=KEY)
sender = client.add_sender(partition="0")
client.run()
try:
start_time = time.time()
for i in range(100):
print("Sending message: {}".format(i))
sender.send(EventData(str(i)))
except:
raise
finally:
end_time = time.time()
client.stop()
run_time = end_time - start_time
logger.info("Runtime: {} seconds".format(run_time))

except KeyboardInterrupt:
pass
All clients failed to start.
Traceback (most recent call last):
  File AzureEventHubSender.py", line 21, in <module>
    client.run()
  File "client.py", line 322, in run
    raise failed[0]
azure.eventhub.common.EventHubError: Unable to open authentication session on connection b'EHSender-be4839bc-f170-4ef7-9516-341449c5e1aa-partition0'.
Please confirm target hostname exists: b'nmeventhubwestus.servicebus.windows.net'

Process finished with exit code 1

as suggested on different post I opened port 5672, 5671 and 433 outbound on my machine and it still gives same error. 


Viewing all articles
Browse latest Browse all 1916

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>