From f85ae752664349391a0b8079b18cadfac90a7073 Mon Sep 17 00:00:00 2001 From: Jeff Xiang Date: Tue, 22 Oct 2024 21:38:42 -0400 Subject: [PATCH] Catch IOException --- .../com/pinterest/psc/example/kafka/ExamplePscProducer.java | 4 +++- .../com/pinterest/psc/example/migration/producer/Psc.java | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/psc-examples/src/main/java/com/pinterest/psc/example/kafka/ExamplePscProducer.java b/psc-examples/src/main/java/com/pinterest/psc/example/kafka/ExamplePscProducer.java index f8eff87..bbbf577 100644 --- a/psc-examples/src/main/java/com/pinterest/psc/example/kafka/ExamplePscProducer.java +++ b/psc-examples/src/main/java/com/pinterest/psc/example/kafka/ExamplePscProducer.java @@ -9,12 +9,14 @@ import com.pinterest.psc.serde.IntegerSerializer; import com.pinterest.psc.serde.StringSerializer; +import java.io.IOException; + public class ExamplePscProducer { private static final PscLogger logger = PscLogger.getLogger(ExamplePscProducer.class); private static final int NUM_MESSAGES = 10; - public static void main(String[] args) throws ConfigurationException, ProducerException { + public static void main(String[] args) throws ConfigurationException, ProducerException, IOException { if (args.length < 1) { logger.error("ExamplePscProducer needs one argument: topicUri"); return; diff --git a/psc-examples/src/main/java/com/pinterest/psc/example/migration/producer/Psc.java b/psc-examples/src/main/java/com/pinterest/psc/example/migration/producer/Psc.java index 60c9a57..cf8f38c 100644 --- a/psc-examples/src/main/java/com/pinterest/psc/example/migration/producer/Psc.java +++ b/psc-examples/src/main/java/com/pinterest/psc/example/migration/producer/Psc.java @@ -1,5 +1,6 @@ package com.pinterest.psc.example.migration.producer; +import java.io.IOException; import java.util.concurrent.atomic.AtomicInteger; import com.pinterest.psc.config.PscConfiguration; @@ -11,7 +12,7 @@ public class Psc { - static public void main(String[] args) throws ConfigurationException, ProducerException { + static public void main(String[] args) throws ConfigurationException, ProducerException, IOException { String topicUri = "plaintext:/rn:kafka:dev:local-cloud_local-region::local-cluster:my_test_topic"; PscConfiguration pscConfiguration = new PscConfiguration();