Skip to content

Commit a9e8397

Browse files
committed
Update PubSub examples, snippets and READMEs to use renamed getters/setters/builders
1 parent 19466be commit a9e8397

6 files changed

Lines changed: 8 additions & 8 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ try (PubSub pubsub = PubSubOptions.defaultInstance().service()) {
477477
MessageProcessor callback = new MessageProcessor() {
478478
@Override
479479
public void process(Message message) throws Exception {
480-
System.out.printf("Received message \"%s\"%n", message.payloadAsString());
480+
System.out.printf("Received message \"%s\"%n", message.getPayloadAsString());
481481
}
482482
};
483483
// Create a message consumer and pull messages (for 60 seconds)

TESTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ and `start` methods. This will bind a port for communication with the local Pub/
189189
2. Create and use a `PubSub` object with the options given by the `LocalPubSubHelper` instance. For
190190
example:
191191
```java
192-
PubSub localPubsub = helper.options().service();
192+
PubSub localPubsub = helper.getOptions().service();
193193
```
194194

195195
3. Run your tests.

google-cloud-examples/src/main/java/com/google/cloud/examples/pubsub/PubSubExample.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ private static class CreateSubscriptionAction extends PubSubAction<SubscriptionI
360360
@Override
361361
public void run(PubSub pubsub, SubscriptionInfo subscription) {
362362
pubsub.create(subscription);
363-
System.out.printf("Created subscription %s%n", subscription.name());
363+
System.out.printf("Created subscription %s%n", subscription.getName());
364364
}
365365

366366
@Override
@@ -371,9 +371,9 @@ SubscriptionInfo parse(String... args) throws Exception {
371371
} else if (args.length < 2) {
372372
message = "Missing required topic or subscription name";
373373
} else {
374-
SubscriptionInfo.Builder builder = SubscriptionInfo.builder(args[0], args[1]);
374+
SubscriptionInfo.Builder builder = SubscriptionInfo.newBuilder(args[0], args[1]);
375375
if (args.length == 3) {
376-
builder.pushConfig(PushConfig.of(args[2]));
376+
builder.setPushConfig(PushConfig.of(args[2]));
377377
}
378378
return builder.build();
379379
}

google-cloud-examples/src/main/java/com/google/cloud/examples/pubsub/snippets/CreateSubscriptionAndPullMessages.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public static void main(String... args) throws Exception {
3737
MessageProcessor callback = new MessageProcessor() {
3838
@Override
3939
public void process(Message message) throws Exception {
40-
System.out.printf("Received message \"%s\"%n", message.payloadAsString());
40+
System.out.printf("Received message \"%s\"%n", message.getPayloadAsString());
4141
}
4242
};
4343
// Create a message consumer and pull messages (for 60 seconds)

google-cloud-pubsub/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ Then, to pull messages asynchronously, use the following code:
158158
MessageProcessor callback = new MessageProcessor() {
159159
@Override
160160
public void process(Message message) throws Exception {
161-
System.out.printf("Received message \"%s\"%n", message.payloadAsString());
161+
System.out.printf("Received message \"%s\"%n", message.getPayloadAsString());
162162
}
163163
};
164164
// Create a message consumer and pull messages (for 60 seconds)

google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/testing/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* <pre> {@code
2323
* LocalPubSubHelper helper = LocalPubSubHelper.create();
2424
* helper.start();
25-
* PubSub localPubsub = helper.options().service();
25+
* PubSub localPubsub = helper.getOptions().service();
2626
* } </pre>
2727
*
2828
* <p>After the test:

0 commit comments

Comments
 (0)