我已经使用编码 [1] 启动了 google pub sub 的发布者。完成发布者后,我将发布者关闭为 [2]。但是当我运行时,我收到一个错误 [3],说发布者不正确关掉。我正在使用 pubsub 1.61.0 版本。有没有办法处理这个错误?
[1]
public class PublisherExample {
// use the default project id
private static final String PROJECT_ID = ServiceOptions.getDefaultProjectId();
/** Publish messages to a topic.
* @param args topic name, number of messages
*/
public static void main(String... args) throws Exception {
// topic id, eg. "my-topic"
String topicId = args[0];
int messageCount = Integer.parseInt(args[1]);
ProjectTopicName topicName = ProjectTopicName.of(PROJECT_ID, topicId);
Publisher publisher = null;
List<ApiFuture<String>> futures = new ArrayList<>(); …Run Code Online (Sandbox Code Playgroud)