stan.py
stan.py copied to clipboard
Reconnection problem after server reboot
My environment is :
server: nats-streaming:0.21.1-alpine
asyncio-nats-client @ asyncio-nats-client-0.11.4.tar.gz
asyncio-nats-streaming @ asyncio-nats-streaming-0.4.0.tar.gz
python 3.7
My script is :
import asyncio
from nats.aio.client import Client as NATS
from stan.aio.client import Client as STAN
async def run(loop):
nc = NATS()
await nc.connect(io_loop=loop, allow_reconnect=True)
sc = STAN()
await sc.connect("test-cluster", "client-123", nats=nc)
async def cb(msg):
print("(seq={}): {}".format(msg.seq, msg.data))
sub = await sc.subscribe("hi", start_at='first', cb=cb, durable_name="dname")
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(run(loop))
loop.run_forever()
If I restart the NATS server, the client doesn't receive anymore any message, it just show : empty response from server when expecting INFO message
I tried to force the reconnection using some connection callback but it didn't work
Do I miss something ?
Is there any solution about that issue?
@resulyrt93 no solution found for that! Try with Jetstreams (I didn't try)