Skip to content

Commit 6cd3804

Browse files
committed
add migration doc
1 parent 2239a50 commit 6cd3804

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

google-cloud-pubsub/HP-MIGRATION.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
High-Perf Client Migration
2+
==========================
3+
This document provides an overview of changes introduced by the
4+
high-performance client.
5+
6+
`Subscriber`
7+
------------
8+
Previously, the client provided two ways to pull messages from topics.
9+
- Use the [`pull`](http://googlecloudplatform.github.io/google-cloud-java/0.8.0/apidocs/com/google/cloud/pubsub/PubSub.html#pull-java.lang.String-int-) method then [`ack`](http://googlecloudplatform.github.io/google-cloud-java/0.8.0/apidocs/com/google/cloud/pubsub/PubSub.html#ack-java.lang.String-java.lang.Iterable-) or [`nack`](http://googlecloudplatform.github.io/google-cloud-java/0.8.0/apidocs/com/google/cloud/pubsub/PubSub.html#nack-java.lang.String-java.lang.Iterable-).
10+
- Use the [`pullAsync`](http://googlecloudplatform.github.io/google-cloud-java/0.8.0/apidocs/com/google/cloud/pubsub/PubSub.html#pullAsync-java.lang.String-com.google.cloud.pubsub.PubSub.MessageProcessor-com.google.cloud.pubsub.PubSub.PullOption...-) method and provide a [`callback`](http://googlecloudplatform.github.io/google-cloud-java/0.8.0/apidocs/com/google/cloud/pubsub/PubSub.MessageProcessor.html).
11+
12+
With the high-perf client, there's only one way: the `Subscriber`.
13+
The following is a whimsical example for printing all received messages
14+
to standard output.
15+
```java
16+
Subscriber subscriber = myPubSub.subscriber(mySubscription, new MessageReceiver() {
17+
@Override
18+
ListenableFuture<AckReply> receiveMessage(PubsubMessage message) {
19+
System.out.println(message.getData());
20+
return Futures.immediateFuture(MessageReceiver.AckReply.ACK);
21+
}
22+
});
23+
```

0 commit comments

Comments
 (0)