nats jetstream在调用stream_info(stream_name)时正在计时。

发布于 2025-01-23 22:53:31 字数 1301 浏览 3 评论 0原文

引起错误 nats.errors.timeouterror:nats:超时

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)

在添加流之前使用jetstream上下文时,代码正在错误。删除流并在拨打stream_info()之后调用notFoundError后,返回并处理。为什么返回的异常突然改变?任何帮助将不胜感激。

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

妥活 2025-01-30 22:53:31
  • 是您的nats-server配置为启用JetStream功能(即在其配置文件中或传递-JS命令行参数)?

  • 您的帐户是否允许使用Jetstream? NATS帐户信息将告诉您。

  • Is your nats-server configured to enable JetStream functionality (i.e. 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文