diff --git a/README.md b/README.md index 0bb7b14b1..942d05471 100644 --- a/README.md +++ b/README.md @@ -58,13 +58,13 @@ implementation 'com.google.cloud:google-cloud-pubsub' If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-pubsub:1.120.22' +implementation 'com.google.cloud:google-cloud-pubsub:1.120.23' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.120.22" +libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.120.23" ``` ## Authentication diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Publisher.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Publisher.java index 399d99658..6803e5a43 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Publisher.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Publisher.java @@ -462,6 +462,10 @@ private ApiFuture publishCall(OutstandingBatch outstandingBatch } private void publishOutstandingBatch(final OutstandingBatch outstandingBatch) { + if (outstandingBatch.size() == 0) { + logger.log(Level.WARNING, "Attempted to publish batch with zero messages."); + return; + } final ApiFutureCallback futureCallback = new ApiFutureCallback() { @Override