有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Google calendar API v3在创建频道时返回(503 backendError)

我正在使用Calendar API client library for Java观看频道并获取推送通知。有时,当我尝试在Google上创建频道时,它会返回以下错误响应:

{
  "code" : 503,
  "errors" : [ {
    "domain" : "global",
    "message" : "Failed to create channel",
    "reason" : "backendError"
  } ],
  "message" : "Failed to create channel"
}

文档中没有关于处理此错误的内容:

https://developers.google.com/google-apps/calendar/v3/errors

然而,我想这可能是因为大量的请求被发送到谷歌,而谷歌拒绝连接。也许,这里我需要在一段时间后执行重试。 问题是,处理此错误并开始观看所需频道的正确方法是什么


共 (1) 个答案

  1. # 1 楼答案

    此问题的路由原因可能是网络流量过大。 GoogleCalendarAPI建议使用exponential backoff implementation解决此类错误

    An exponential backoff is an algorithm that repeatedly attempts to execute some action until that action has succeeded, waiting an amount of time that grows exponentially between each attempt, up to some maximum number of attempts.

    您可以找到实现想法here