wildcard_tester.py 507 B

1234567891011121314151617181920212223
  1. import asyncio
  2. from nats.aio.client import Client as NATS
  3. async def example():
  4. # [begin wildcard_tester]
  5. nc = NATS()
  6. await nc.connect(servers=["nats://demo.nats.io:4222"])
  7. await nc.publish("time.us.east", b'...')
  8. await nc.publish("time.us.east.atlanta", b'...')
  9. await nc.publish("time.eu.east", b'...')
  10. await nc.publish("time.eu.east.warsaw", b'...')
  11. await nc.close()
  12. # [end wildcard_tester]
  13. loop = asyncio.get_event_loop()
  14. loop.run_until_complete(example())
  15. loop.close()