diff --git a/CHANGELOG.md b/CHANGELOG.md index fdd324266..d3d69cddc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [1.133.0](https://github.com/googleapis/java-pubsub/compare/v1.132.4...v1.133.0) (2024-10-01) + + +### Features + +* Add OpenTelemetry tracing to the Publisher and Subscriber ([#2086](https://github.com/googleapis/java-pubsub/issues/2086)) ([db522b6](https://github.com/googleapis/java-pubsub/commit/db522b60f1bbec9cc1bfa0c37477044fd2f807c7)) + + +### Dependencies + +* Update dependency com.google.cloud.opentelemetry:exporter-trace to v0.32.0 ([#2205](https://github.com/googleapis/java-pubsub/issues/2205)) ([76f17e4](https://github.com/googleapis/java-pubsub/commit/76f17e4149bf369f2be12fe9d316a23a7f49f137)) +* Update dependency org.assertj:assertj-core to v3.26.3 ([#2204](https://github.com/googleapis/java-pubsub/issues/2204)) ([71c2e76](https://github.com/googleapis/java-pubsub/commit/71c2e762e94895c465c4e737ed8bf7bc583a9c14)) + ## [1.132.4](https://github.com/googleapis/java-pubsub/compare/v1.132.3...v1.132.4) (2024-09-30) diff --git a/README.md b/README.md index 14ab466a3..718a40bc5 100644 --- a/README.md +++ b/README.md @@ -59,13 +59,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.132.4' +implementation 'com.google.cloud:google-cloud-pubsub:1.133.0' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.132.4" +libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.133.0" ``` @@ -414,7 +414,7 @@ Java is a registered trademark of Oracle and/or its affiliates. [kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-pubsub/java11.html [stability-image]: https://img.shields.io/badge/stability-stable-green [maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-pubsub.svg -[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-pubsub/1.132.4 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-pubsub/1.133.0 [authentication]: https://github.com/googleapis/google-cloud-java#authentication [auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes [predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles diff --git a/google-cloud-pubsub-bom/pom.xml b/google-cloud-pubsub-bom/pom.xml index ae20af593..de45a10b4 100644 --- a/google-cloud-pubsub-bom/pom.xml +++ b/google-cloud-pubsub-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-pubsub-bom - 1.132.5-SNAPSHOT + 1.133.0 pom com.google.cloud @@ -52,17 +52,17 @@ com.google.cloud google-cloud-pubsub - 1.132.5-SNAPSHOT + 1.133.0 com.google.api.grpc grpc-google-cloud-pubsub-v1 - 1.114.5-SNAPSHOT + 1.115.0 com.google.api.grpc proto-google-cloud-pubsub-v1 - 1.114.5-SNAPSHOT + 1.115.0 diff --git a/google-cloud-pubsub/pom.xml b/google-cloud-pubsub/pom.xml index bce1d9e5a..467f489aa 100644 --- a/google-cloud-pubsub/pom.xml +++ b/google-cloud-pubsub/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-pubsub - 1.132.5-SNAPSHOT + 1.133.0 jar Google Cloud Pub/Sub https://github.com/googleapis/java-pubsub @@ -11,7 +11,7 @@ com.google.cloud google-cloud-pubsub-parent - 1.132.5-SNAPSHOT + 1.133.0 google-cloud-pubsub diff --git a/grpc-google-cloud-pubsub-v1/pom.xml b/grpc-google-cloud-pubsub-v1/pom.xml index 40ac5c98c..6f4ab6033 100644 --- a/grpc-google-cloud-pubsub-v1/pom.xml +++ b/grpc-google-cloud-pubsub-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-pubsub-v1 - 1.114.5-SNAPSHOT + 1.115.0 grpc-google-cloud-pubsub-v1 GRPC library for grpc-google-cloud-pubsub-v1 com.google.cloud google-cloud-pubsub-parent - 1.132.5-SNAPSHOT + 1.133.0 diff --git a/pom.xml b/pom.xml index fef252580..f8e73d5a5 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-pubsub-parent pom - 1.132.5-SNAPSHOT + 1.133.0 Google Cloud Pub/Sub Parent https://github.com/googleapis/java-pubsub @@ -69,17 +69,17 @@ com.google.api.grpc proto-google-cloud-pubsub-v1 - 1.114.5-SNAPSHOT + 1.115.0 com.google.api.grpc grpc-google-cloud-pubsub-v1 - 1.114.5-SNAPSHOT + 1.115.0 com.google.cloud google-cloud-pubsub - 1.132.5-SNAPSHOT + 1.133.0 diff --git a/proto-google-cloud-pubsub-v1/pom.xml b/proto-google-cloud-pubsub-v1/pom.xml index 9620d5187..eed834a95 100644 --- a/proto-google-cloud-pubsub-v1/pom.xml +++ b/proto-google-cloud-pubsub-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-pubsub-v1 - 1.114.5-SNAPSHOT + 1.115.0 proto-google-cloud-pubsub-v1 PROTO library for proto-google-cloud-pubsub-v1 com.google.cloud google-cloud-pubsub-parent - 1.132.5-SNAPSHOT + 1.133.0 diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index da0ac10b1..965d7300f 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -44,7 +44,7 @@ com.google.cloud google-cloud-pubsub - 1.132.3 + 1.133.0 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 3ee0f74d6..56c7c619e 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -43,7 +43,7 @@ com.google.cloud google-cloud-pubsub - 1.132.5-SNAPSHOT + 1.133.0 diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index ec07da956..a6bcbd096 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -45,7 +45,7 @@ com.google.cloud libraries-bom - 26.47.0 + 26.48.0 pom import diff --git a/samples/snippets/src/main/java/pubsub/UsePubSubEmulatorExample.java b/samples/snippets/src/main/java/pubsub/UsePubSubEmulatorExample.java index f4c69eac4..5da0bd7f8 100644 --- a/samples/snippets/src/main/java/pubsub/UsePubSubEmulatorExample.java +++ b/samples/snippets/src/main/java/pubsub/UsePubSubEmulatorExample.java @@ -16,6 +16,15 @@ package pubsub; +/** + * Snippet that demonstrates creating Pub/Sub clients using the Google Cloud Pub/Sub emulator. + * + *

Note: clients cannot start/stop the emulator. + */ + +// [START pubsub_use_emulator] + +import com.google.api.core.ApiFuture; import com.google.api.gax.core.CredentialsProvider; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GrpcTransportChannel; @@ -24,20 +33,16 @@ import com.google.cloud.pubsub.v1.Publisher; import com.google.cloud.pubsub.v1.TopicAdminClient; import com.google.cloud.pubsub.v1.TopicAdminSettings; +import com.google.protobuf.ByteString; +import com.google.pubsub.v1.PubsubMessage; +import com.google.pubsub.v1.Topic; import com.google.pubsub.v1.TopicName; import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; import java.io.IOException; -/** - * Snippet that demonstrates creating Pub/Sub clients using the Google Cloud Pub/Sub emulator. - * - *

Note: clients cannot start/stop the emulator. - */ public class UsePubSubEmulatorExample { - - public static void main(String... args) throws IOException { - // [START pubsub_use_emulator] + public static void main(String... args) throws Exception { String hostport = System.getenv("PUBSUB_EMULATOR_HOST"); ManagedChannel channel = ManagedChannelBuilder.forTarget(hostport).usePlaintext().build(); try { @@ -46,8 +51,8 @@ public static void main(String... args) throws IOException { CredentialsProvider credentialsProvider = NoCredentialsProvider.create(); // Set the channel and credentials provider when creating a `TopicAdminClient`. - // Similarly for SubscriptionAdminClient - TopicAdminClient topicClient = + // Can be done similarly for a `SubscriptionAdminClient`. + TopicAdminClient topicAdminClient = TopicAdminClient.create( TopicAdminSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -55,16 +60,27 @@ public static void main(String... args) throws IOException { .build()); TopicName topicName = TopicName.of("my-project-id", "my-topic-id"); + Topic topic = topicAdminClient.createTopic(topicName); + System.out.println("Created topic: " + topic.getName()); + // Set the channel and credentials provider when creating a `Publisher`. - // Similarly for Subscriber + // Can be done similarly for a `Subscriber`. Publisher publisher = Publisher.newBuilder(topicName) .setChannelProvider(channelProvider) .setCredentialsProvider(credentialsProvider) .build(); + + String message = "Hello World!"; + ByteString data = ByteString.copyFromUtf8(message); + PubsubMessage pubsubMessage = PubsubMessage.newBuilder().setData(data).build(); + + ApiFuture messageIdFuture = publisher.publish(pubsubMessage); + String messageId = messageIdFuture.get(); + System.out.println("Published message ID: " + messageId); } finally { channel.shutdown(); } - // [END pubsub_use_emulator] } } +// [END pubsub_use_emulator] \ No newline at end of file diff --git a/versions.txt b/versions.txt index 3ae78d30e..3074b8f25 100644 --- a/versions.txt +++ b/versions.txt @@ -1,6 +1,6 @@ # Format: # module:released-version:current-version -google-cloud-pubsub:1.132.4:1.132.5-SNAPSHOT -grpc-google-cloud-pubsub-v1:1.114.4:1.114.5-SNAPSHOT -proto-google-cloud-pubsub-v1:1.114.4:1.114.5-SNAPSHOT +google-cloud-pubsub:1.133.0:1.133.0 +grpc-google-cloud-pubsub-v1:1.115.0:1.115.0 +proto-google-cloud-pubsub-v1:1.115.0:1.115.0