diff --git a/src/main/java/io/kestra/plugin/gcp/pubsub/Publish.java b/src/main/java/io/kestra/plugin/gcp/pubsub/Publish.java index de02925b..3385dd8f 100644 --- a/src/main/java/io/kestra/plugin/gcp/pubsub/Publish.java +++ b/src/main/java/io/kestra/plugin/gcp/pubsub/Publish.java @@ -91,7 +91,7 @@ public Publish.Output run(RunContext runContext) throws Exception { flowable = FileSerde.readAll(inputStream, Message.class); resultFlowable = this.buildFlowable(flowable, publisher, runContext); - count = resultFlowable.reduce(Integer::sum).block(); + count = resultFlowable.reduce(Integer::sum).blockOptional().orElse(0); } } else if (this.from instanceof List) { @@ -101,7 +101,7 @@ public Publish.Output run(RunContext runContext) throws Exception { resultFlowable = this.buildFlowable(flowable, publisher, runContext); - count = resultFlowable.reduce(Integer::sum).block(); + count = resultFlowable.reduce(Integer::sum).blockOptional().orElse(0); } else { var msg = JacksonMapper.toMap(this.from, Message.class); publisher.publish(msg.to(runContext, this.serdeType));