未使用 com.google.cloud.pubsub.v1 获取 TopicName class 的 'of' 方法
Not getting 'of' method for TopicName class using com.google.cloud.pubsub.v1
我正在使用 GCP PubSub 并使用 TopicName class。我想写下面的代码:
TopicName topicName = TopicName.of(projectId, topicId);
但是我找不到'of'
方法。
谁能指出我做错了什么。
我总结我们的讨论作为答案。
您指的是 documentation, which explains how to publish a message in PubSub using Java and you got an error referent to the TopicName.of(projectId, topicId)
. Since this method is referenced in the documentation, its execution depends on adding the required Java dependencies. In order to do so, you have to follow the Quickstart and prepare your environment. Afterwards, you will be able to follow the Publishing messages to topics 教程。
我正在使用 GCP PubSub 并使用 TopicName class。我想写下面的代码:
TopicName topicName = TopicName.of(projectId, topicId);
但是我找不到'of'
方法。
谁能指出我做错了什么。
我总结我们的讨论作为答案。
您指的是 documentation, which explains how to publish a message in PubSub using Java and you got an error referent to the TopicName.of(projectId, topicId)
. Since this method is referenced in the documentation, its execution depends on adding the required Java dependencies. In order to do so, you have to follow the Quickstart and prepare your environment. Afterwards, you will be able to follow the Publishing messages to topics 教程。