google-app-engine - 谷歌发布订阅 : UNAVAILABLE: The service was unable to fulfill your request

标签 google-app-engine google-cloud-platform google-cloud-pubsub

我正在使用 java 库从我的代码订阅订阅。使用 sbt: "com.google.cloud"% "google-cloud-pubsub"% "0.24.0-beta"

我按照本指南写了一个订阅者:https://cloud.google.com/pubsub/docs/pull

 val projectId = "test-topic"
 val subscriptionId = "test-sub"

def main(args: Array[String]): Unit = {
 val subscriptionName = SubscriptionName.create(projectId, subscriptionId)
 val subscriber = Subscriber.defaultBuilder(subscriptionName, new PastEventMessageReceiver()).build()
 subscriber.startAsync()
 System.in.read()
}


class PastEventMessageReceiver extends MessageReceiver {
  override def receiveMessage(message: PubsubMessage, consumer: AckReplyConsumer): Unit = {
  println(message)
  consumer.ack()
}

效果很好,我能够提取已发布的消息,但我在日志中每分钟多次看到此错误。

 com.google.cloud.pubsub.v1.StreamingSubscriberConnection$1 onFailure
WARNING: Terminated streaming with exception
io.grpc.StatusRuntimeException: UNAVAILABLE: The service was unable to fulfill your request. Please try again. [code=8a75]
    at io.grpc.Status.asRuntimeException(Status.java:526)
    at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:385)
    at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:422)
    at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:61)
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:504)
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$600(ClientCallImpl.java:425)
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:536)
    at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
    at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:102)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

当我第一次运行该应用程序时,有一小段延迟(大约 1-2 分钟),我没有看到该错误,延迟后我每分钟看到多次。我的应用程序似乎仍然能够强硬地提取消息。

最佳答案

此消息是 Google Cloud Pub/Sub 库中的内部错误,当发送到 Pub/Sub 服务器的请求中出现断开连接或可重试错误时会发生该错误。客户端库应该无缝地重新创建连接并重试这些错误的请求。在客户端库的 0.26.0-beta 版及更高版本中,除非您 have the log level set to FINE,否则这些错误不应再在日志中打印出来。 .一般来说,发生此错误后,消息仍应继续发送到您的 MessageReceiver。客户端库本身不可重试的任何错误,例如,当未找到订阅时,都会传播回调用方。

关于google-app-engine - 谷歌发布订阅 : UNAVAILABLE: The service was unable to fulfill your request,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46914087/

相关文章:

google-cloud-platform - GCP 上的云功能 : no exit log

java - 数据流管道和发布订阅模拟器

google-app-engine - 谷歌应用引擎 : SimpleAuth : Redirect Url On the Fly

spring - Google 应用引擎与 Spring 框架的兼容性

java - 读取存储在 GAE Blobstore 中的 zip 文件

java - Google PubSub 重新发送的消息未得到处理

node.js - 如何在 Google Cloud PubSub 中提供订阅的过期时间

python - 我应该采取哪些诊断步骤来修复此授权?

json - 如何在使用 Cloud Scheduler 发出的 HTTP POST 请求中添加 JSON 正文?它会添加 "Content-Type": "application/json" header?

google-cloud-platform - Terraform:如何在 google_container_cluster 资源之后创建 named_port?