pynats icon indicating copy to clipboard operation
pynats copied to clipboard

Example cannot be run in full

Open SamuelMarks opened this issue 10 years ago • 0 comments

On Windows I ran:

> go version
go version go1.4.2 windows/amd64
> go get -u github.com/apcera/gnatsd
> python --version && pip --version
Python 2.7.9
pip 1.5.6 from Python27\lib\site-packages (python 2.7)
> pip install git+https://github.com/mcuadros/pynats#egg=pynats

Then started the server:

> gnatsd
[3032] 2015/05/06 22:21:11.011486 [INF] Starting gnatsd version 0.6.0
[3032] 2015/05/06 22:21:11.012486 [INF] Listening for client connections on 0.0.0.0:4222
[3032] 2015/05/06 22:21:11.012486 [INF] gnatsd is ready

Got the example:

> python -c "from urllib import urlopen; from sys import argv;open(argv[1], 'w').write((lambda r: (lambda first_tick: 'import pynats\n'+r[first_tick:r.find('```',first_tick+1)])(r.find('```')+len('```python')))(urlopen('https://raw.githubusercontent.com/mcuadros/pynats/master/README.md').read()))" example.py

Then ran it:

> python example.py

And it just hung. Running it through, everything appears to be working up and until:

c.subscribe('foo', callback)

Debugging it properly and it appears that I need to send through a message, i.e.: that's what it is waiting for.

Want me to write example using concurrent.futures, to automatically send through an event, e.g.: after 5 seconds?

SamuelMarks avatar May 06 '15 13:05 SamuelMarks