我正在使用 Amazon Kinesis Producer Library 向 Amazon Kinesis 发送一些数据。但是,我无法调试该问题,因为 Kinesis 在并发线程上工作,并且异常未在 ExecutionException/InterruptedException 中捕获。
这是示例实现。
// Creating a kinesis producer.
KinesisProducer kinesisProducer = .....;
log.info("Successfully created kinesis producer");
//Verifying the metrics of kinesis producer.
List<Metric> metric = new ArrayList<>;
try{
log.info("Publishing Metrics");
metric = kinesisProducer.getMetrics();
} catch (InterruptedException e) {
log.info("Interrupted Exception");
log.info(e.getMessage());
} catch (ExecutionException e) {
log.info("Execution exception");
log.info(e.getMessage());
}
for(Metric metric1: metric) {
log.info(metric1);
}
log.info("Metrics successfully Printed");
运行的输出
Successfully created kinesis producer
Publishing Metrics