Skip to content

Instantly share code, notes, and snippets.

@ripiuk
Created March 29, 2018 11:27
Show Gist options
  • Save ripiuk/3eecc703661dc122ca471551a55289af to your computer and use it in GitHub Desktop.
Save ripiuk/3eecc703661dc122ca471551a55289af to your computer and use it in GitHub Desktop.
A simple nsq reader
import nsq
lookup_http_addresses = ['http://127.0.0.1:4161']
topic = 'hotel-active'
chanel = 'hotel'
def handler(message):
print(message.body)
return True
r = nsq.Reader(message_handler=handler,
lookupd_http_addresses=lookup_http_addresses,
topic=topic, channel=chanel, lookupd_poll_interval=15)
nsq.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment