Google长期运行状态检查问题

问题描述

我已提交google batchTranslation并获得了operationId(项目// locations / us-central1 / operations /)。

现在我想通过合并检查此操作的状态。在这里我使用了以下依赖项

<dependency>
  <groupId>com.google.api</groupId>
  <artifactId>gax-grpc</artifactId>
  <version>1.58.2</version>
</dependency>
<dependency>
  <groupId>com.google.api</groupId>
  <artifactId>gax</artifactId>
  <version>1.58.2</version>
</dependency>

在Java类中添加了以下代码:

GoogleCredentials credentials = GoogleCredentials
                                .fromStream(new ByteArrayInputStream(serviceKey.getBytes()))
                                                                                   .createScoped(Lists.newArrayList("https://clicktime.symantec.com/3TWFMHceuuMgwf8KebwWinm7Vc?u=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform%2522%29%29%3B
OperationsSettings operationsSettings =                OperationsSettings.newBuilder().setCredentialsProvider(FixedCredentialsProvider.create(credentials)).build();

OperationsClient operationsClient = OperationsClient.create(operationsSettings);

但是在这里,当我尝试创建OperationsClient时会出现nullpointerException

                at com.google.longrunning.stub.OperationsStubSettings.createStub(OperationsStubSettings.java:107)
                at com.google.longrunning.OperationsClient.<init>(OperationsClient.java:143)
                at com.google.longrunning.OperationsClient.create(OperationsClient.java:125)

进一步调查发现,创建的OperationsSettings的transportChannelProvider为null。

请指导我,在创建OperationSettings / OperationClient时是否丢失了某些内容? 在Java中查找Google长期运行状态的最佳方法是什么。

谢谢, 兰吉特·库玛(Ranjit Kumar)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)