We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9a634a3 commit 693f610Copy full SHA for 693f610
1 file changed
README.md
@@ -20,7 +20,21 @@ $ pip install nats-python
20
from pynats import NATSClient
21
22
with NATSClient() as client:
23
- client.publish("test-subject", payload=b"test-payload")
+ # Connect
24
+ client.connect()
25
+
26
+ # Subscribe
27
+ def callback(msg):
28
+ message = '%s' % msg
29
+ print('Received a message with subject ' + msg.subject + ': ' + message)
30
31
+ client.subscribe(subject="test-subject", callback=callback)
32
33
+ # Publish a message
34
+ client.publish(subject="test-subject", payload=b"test-payload")
35
36
+ # wait for 1 message
37
+ client.wait(count=1)
38
```
39
40
## Contributing
0 commit comments