Firebase Admin SDK Java后退/重试 [英] Firebase Admin SDK Java Backoff/retry

查看:115
本文介绍了Firebase Admin SDK Java后退/重试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在实施Firebase Server环境时,我遇到了文档中的一些要求: https://firebase.google.com/docs/cloud-messaging/server#角色

In implementing a Firebase Server Environment I ran across some requirements in the documentation: https://firebase.google.com/docs/cloud-messaging/server#role

即,要求服务器提供退避/重试功能.

Namely, the requirement that the server provide facilities for backoff/retry.

关于Firebase Admin SDK使用情况应如何包装在这种逻辑中,或者该逻辑是否包含在SDK本身中,是否有什么方向?

Is there some direction as to how the Firebase Admin SDK usage should be wrapped in such logic or is the logic contained within the SDK itself?

我确实在Firebase Admin SDK发行说明中看到了这一点,该说明确实提到了处理500个响应代码的重试: https://firebase.google.com/support/release- notes/admin/java#version_681 _-_ april_24_2019

I did see this in the Firebase Admin SDK release notes that does mention handling of retry for 500 response codes: https://firebase.google.com/support/release-notes/admin/java#version_681_-_april_24_2019

由于此处提到的ErrorCodes实际上并未返回数字响应代码,因此尚不清楚它们是否被此更改所覆盖. https://firebase.google.com/support/release-notes/admin/java#firebase-cloud-messaging_1

Since the ErrorCodes mentioned here don't actually return the numeric response codes, it's unclear whether they are covered by this change. https://firebase.google.com/support/release-notes/admin/java#firebase-cloud-messaging_1

在实现这种服务器时,还应该考虑其他使用限制吗?

Are there other usage constraints or limitations one should consider when implementing such a server?

推荐答案

Admin SDK已经为您完成了此操作.所有符合重试条件的错误(即所有HTTP 500和503错误)最多可重试4次,并采用指数补偿.如果错误响应包含Retry-After标头,则也应遵守.

Admin SDK already does this for you. All retry-eligible errors (that's all HTTP 500 and 503 errors) are retried up to 4 times with exponential backoff. If the error response contains Retry-After header, that is respected too.

这篇关于Firebase Admin SDK Java后退/重试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆