File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed
main/java/com/example/pubsub
test/java/com/example/pubsub Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 3131 <maven .compiler.target>1.8</maven .compiler.target>
3232 <maven .compiler.source>1.8</maven .compiler.source>
3333 <project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
34- <pubsub .version>0.9.4 -alpha</pubsub .version>
34+ <pubsub .version>0.11.2 -alpha</pubsub .version>
3535 </properties >
3636
3737 <dependencies >
Original file line number Diff line number Diff line change 2020// Imports the Google Cloud client library
2121
2222import com .google .cloud .ServiceOptions ;
23- import com .google .cloud .pubsub .spi .v1 .PublisherClient ;
23+ import com .google .cloud .pubsub .spi .v1 .TopicAdminClient ;
2424import com .google .pubsub .v1 .TopicName ;
2525
2626public class QuickstartSample {
@@ -35,8 +35,8 @@ public static void main(String... args) throws Exception {
3535
3636 // Create a new topic
3737 TopicName topic = TopicName .create (projectId , topicId );
38- try (PublisherClient publisherClient = PublisherClient .create ()) {
39- publisherClient .createTopic (topic );
38+ try (TopicAdminClient topicAdminClient = TopicAdminClient .create ()) {
39+ topicAdminClient .createTopic (topic );
4040 }
4141
4242 System .out .printf ("Topic %s:%s created.\n " , topic .getProject (), topic .getTopic ());
Original file line number Diff line number Diff line change 1919import static com .google .common .truth .Truth .assertThat ;
2020
2121import com .google .cloud .ServiceOptions ;
22- import com .google .cloud .pubsub .spi .v1 .PublisherClient ;
22+ import com .google .cloud .pubsub .spi .v1 .TopicAdminClient ;
2323import com .google .pubsub .v1 .TopicName ;
2424
2525import org .junit .After ;
@@ -43,8 +43,8 @@ public class QuickstartSampleIT {
4343 private PrintStream out ;
4444
4545 private void deleteTestTopic () throws Exception {
46- try (PublisherClient publisherClient = PublisherClient .create ()) {
47- publisherClient .deleteTopic (
46+ try (TopicAdminClient topicAdminClient = TopicAdminClient .create ()) {
47+ topicAdminClient .deleteTopic (
4848 TopicName .create (ServiceOptions .getDefaultProjectId (), "my-new-topic" ));
4949 } catch (IOException e ) {
5050 System .err .println ("Error deleting topic " + e .getMessage ());
You can’t perform that action at this time.
0 commit comments