Skip to content

Commit ad39c23

Browse files
committed
Update README.md
Readme updated
1 parent 2441767 commit ad39c23

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,33 @@ def process(message):
150150
print(f'Message Received: {message}')
151151

152152
try:
153-
topic_object.subscribe(subscription='subscriptionName')
153+
topic_object.subscribe(subscription='subscriptionName',process)
154154
except Exception as e:
155155
print(e)
156156
```
157157

158+
- Please note that `subscribe` is a blocking call which runs on a loop. Either use a `thread.Thread` to subscribe or an async method to continue with the other parts of the program
159+
160+
eg.
161+
```python
162+
163+
from python_ms_core import Core
164+
import threading
165+
166+
core = Core()
167+
topic_object = topic = Core.get_topic(topic_name='topicName')
168+
169+
def process(message):
170+
print(f'Message Received: {message}')
171+
172+
try:
173+
thread = threading.Thread(topic_object.subscribe, ['subscriptionName',process])
174+
thread.start()
175+
except Exception as e:
176+
print(e)
177+
178+
```
179+
158180
### Storage
159181
For all the azure blobs and other storages, storage components will offer simple ways to upload/download and read the existing data.
160182
```python

0 commit comments

Comments
 (0)