Google Cloud Pub Sub StreamingPull does not work correctly

0

Does anybody know, does Google Cloud PubSub client support StreamingPull?

This code:

SubscriberServiceApiClient client = SubscriberServiceApiClient.Create();
SubscriberServiceApiClient.StreamingPullStream stream = client.StreamingPull();
await stream.WriteAsync(new StreamingPullRequest { SubscriptionAsSubscriptionName = subscriptionName });

Task pullingTask = Task.Run(async () =>
{
    AsyncResponseStream<StreamingPullResponse> responseStream = stream.GetResponseStream();
    while (await responseStream.MoveNextAsync())
    {
        StreamingPullResponse response = responseStream.Current;
        Console.WriteLine("Received streaming response");
        foreach (ReceivedMessage message in response.ReceivedMessages)
        {
            Console.WriteLine($"Message text: {message.Message.Data.ToStringUtf8()}");
        }
    }
});

publisher.Publish(topicName, new[] { new PubsubMessage { Data = ByteString.CopyFromUtf8("Message 1") } });
publisher.Publish(topicName, new[] { new PubsubMessage { Data = ByteString.CopyFromUtf8("Message 2") } });
publisher.Publish(topicName, new[] { new PubsubMessage { Data = ByteString.CopyFromUtf8("Message 3") } });

await stream.WriteCompleteAsync();

Throwing the next exception:

    Grpc.Core.RpcException
  HResult=0x80131500
  Message=Status(StatusCode=Internal, Detail="A service error has occurred. Please retry your request. If the error persists, please report it. [code=e8c0]")
  Source=System.Private.CoreLib

This line is a problem : while (await responseStream.MoveNextAsync())

c#
.net
google-cloud-pubsub
asked on Stack Overflow Oct 22, 2020 by MakeItSimple • edited Oct 22, 2020 by Jon Skeet

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0