Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Dec 31, 2025. It is now read-only.
This repository was archived by the owner on Dec 31, 2025. It is now read-only.

Reconnection problem after server reboot #51

@chermed

Description

@chermed

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions