Skip to content

Commit acd4272

Browse files
committed
Use appassembler in Pub/Sub example
1 parent f4a41a5 commit acd4272

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

gcloud-java-examples/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ To run examples from your command line:
104104
105105
Before running the example, go to the [Google Developers Console][developers-console] to ensure that "Google Cloud Pub/Sub" is enabled.
106106
```
107-
mvn exec:java -Dexec.mainClass="com.google.cloud.examples.pubsub.PubSubExample" -Dexec.args="create topic test-topic"
108-
mvn exec:java -Dexec.mainClass="com.google.cloud.examples.pubsub.PubSubExample" -Dexec.args="create subscription test-topic test-subscription"
109-
mvn exec:java -Dexec.mainClass="com.google.cloud.examples.pubsub.PubSubExample" -Dexec.args="publish test-topic message1 message2"
110-
mvn exec:java -Dexec.mainClass="com.google.cloud.examples.pubsub.PubSubExample" -Dexec.args="pull sync test-subscription 2"
107+
target/appassembler/bin/PubSubExample create topic test-topic
108+
target/appassembler/bin/PubSubExample create subscription test-topic test-subscription
109+
target/appassembler/bin/PubSubExample publish test-topic message1 message2
110+
target/appassembler/bin/PubSubExample pull sync test-subscription 2
111111
```
112112
113113
* Here's an example run of `ResourceManagerExample`.

gcloud-java-examples/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@
8080
<mainClass>com.google.cloud.examples.nio.ParallelCountBytes</mainClass>
8181
<name>ParallelCountBytes</name>
8282
</program>
83+
<program>
84+
<mainClass>
85+
com.google.cloud.examples.pubsub.PubSubExample
86+
</mainClass>
87+
<name>PubSubExample</name>
88+
</program>
8389
<program>
8490
<mainClass>
8591
com.google.cloud.examples.resourcemanager.ResourceManagerExample

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,10 @@
4343
*
4444
* <p>This example demonstrates a simple/typical Pub/Sub usage.
4545
*
46-
* <p>Steps needed for running the example:
47-
* <ol>
48-
* <li>login using gcloud SDK - {@code gcloud auth login}.</li>
49-
* <li>compile using maven - {@code mvn compile}</li>
50-
* <li>run using maven -
51-
* <pre>{@code mvn exec:java -Dexec.mainClass="com.google.cloud.examples.pubsub.PubSubExample"
46+
* <p>See the
47+
* <a href="https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/README.md">
48+
* README</a> for compilation instructions. Run this code with
49+
* <pre>{@code target/appassembler/bin/PubSubExample
5250
* -Dexec.args="[<project_id>]
5351
* pull async <subscription> <timeoutMillis>?
5452
* pull sync <subscription> <maxMessages>
@@ -64,8 +62,6 @@
6462
* delete subscription <subscription>
6563
* info topic <topic>
6664
* info subscription <subscription>"}</pre>
67-
* </li>
68-
* </ol>
6965
*
7066
* <p>The first parameter is an optional {@code project_id} (logged-in project will be used if not
7167
* supplied). Second parameter is a Pub/Sub operation and can be used to demonstrate its usage. For

0 commit comments

Comments
 (0)