nats_consume.py 439 B

12345678910111213
  1. from pynats import NATSClient
  2. from data_develop import develop_callback
  3. from config import nats_subject, nats_url
  4. with NATSClient(url=nats_url) as client:
  5. try:
  6. client.connect()
  7. client.subscribe(subject=nats_subject, callback=develop_callback)
  8. client.wait()
  9. except Exception as e:
  10. print("We faced error such as:", e)
  11. print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')