@@ -8,7 +8,7 @@ manager: femila
8
8
ms.service : event-hubs
9
9
ms.workload : core
10
10
ms.topic : article
11
- ms.date : 04/15 /2019
11
+ ms.date : 09/16 /2019
12
12
ms.author : shvija
13
13
14
14
---
@@ -66,11 +66,11 @@ logger = logging.getLogger("azure")
66
66
# "amqps://<URL-encoded-SAS-policy>:<URL-encoded-SAS-key>@<mynamespace>.servicebus.windows.net/myeventhub"
67
67
# "amqps://<mynamespace>.servicebus.windows.net/myeventhub"
68
68
# For example:
69
- ADDRESS = " amqps://mynamespace .servicebus.windows.net/myeventhub "
69
+ ADDRESS = " amqps://<EVENTHUBS NAMESPACE NAME> .servicebus.windows.net/<EVENTHUB NAME> "
70
70
71
71
# SAS policy and key are not required if they are encoded in the URL
72
72
USER = " RootManageSharedAccessKey"
73
- KEY = " namespaceSASKey "
73
+ KEY = " <SHARED ACCESS KEY FOR THE EVENT HUBS NAMESPACE> "
74
74
75
75
try :
76
76
if not ADDRESS :
84
84
start_time = time.time()
85
85
for i in range (100 ):
86
86
print (" Sending message: {} " .format(i))
87
- sender.send(EventData(str (i)))
87
+ message = " Message {} " .format(i)
88
+ sender.send(EventData(message))
88
89
except :
89
90
raise
90
91
finally :
@@ -130,11 +131,12 @@ logger = logging.getLogger("azure")
130
131
# "amqps://<URL-encoded-SAS-policy>:<URL-encoded-SAS-key>@<mynamespace>.servicebus.windows.net/myeventhub"
131
132
# "amqps://<mynamespace>.servicebus.windows.net/myeventhub"
132
133
# For example:
133
- ADDRESS = " amqps://mynamespace .servicebus.windows.net/myeventhub "
134
+ ADDRESS = " amqps://<EVENTHUBS NAMESPACE NAME> .servicebus.windows.net/<EVENTHUB NAME> "
134
135
135
136
# SAS policy and key are not required if they are encoded in the URL
136
137
USER = " RootManageSharedAccessKey"
137
- KEY = " namespaceSASKey"
138
+ KEY = " <SHARED ACCESS KEY FOR THE EVENT HUBS NAMESPACE>"
139
+
138
140
CONSUMER_GROUP = " $default"
139
141
OFFSET = Offset(" -1" )
140
142
PARTITION = " 0"
149
151
client.run()
150
152
start_time = time.time()
151
153
for event_data in receiver.receive(timeout = 100 ):
152
- last_offset = event_data.offset
153
- last_sn = event_data.sequence_number
154
- print (" Received: {} , {} " .format(last_offset, last_sn))
154
+ print (" Received: {} " .format(event_data.body_as_str(encoding = ' UTF-8' )))
155
155
total += 1
156
156
157
157
end_time = time.time()
0 commit comments