简体   繁体   中英

NATS JetStream is Timing out when calling stream_info(STREAM_NAME)

raise errors.TimeoutError nats.errors.TimeoutError: nats: timeout

if self.nc.is_connected:
            log.info(f"NATS client successfully connected to {SERVERS}")
            # Create jetstream context and check if stream exists
            self.nc = self.nc.jetstream()
            log.info("Created contextual JetStream object!")
            try:
                # Check if the JetStream exists [Client has already created JetStream and subject associations]
                acc_info = await self.nc.account_info()
                info = await self.nc.stream_info(STREAM_NAME)

The code is erroring out when using the JetStream context prior to adding a stream. Upon deletion of a stream, and calling stream_info() after, the NotFoundError is returned and handled. Why does the returned exception change so suddenly? Any help is greatly appreciated.

File "/usr/local/lib/python3.9/site-packages/nats/js/manager.py", line 65, in stream_info
    resp = await self._api_request(
  File "/usr/local/lib/python3.9/site-packages/nats/js/manager.py", line 158, in _api_request
    msg = await self._nc.request(req_subject, req, timeout=timeout)
  File "/usr/local/lib/python3.9/site-packages/nats/aio/client.py", line 899, in request
    msg = await self._request_new_style(
  File "/usr/local/lib/python3.9/site-packages/nats/aio/client.py", line 939, in _request_new_style
    raise errors.TimeoutError
nats.errors.TimeoutError: nats: timeout
  • Is your nats-server configured to enable JetStream functionality (ie either in it's config file or passing the -js command line argument)?

  • Is your account allowed to use JetStream? nats account info will tell you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM