File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -105,11 +105,12 @@ Topic topic =
105105 .setName(topicPath. value())
106106 .build();
107107
108- AdminClient client = AdminClientBuilder . builder()
109- .setRegion(region)
110- .setExecutor(executor)
111- .build();
112- client. createTopic(topic). get();
108+ try (AdminClient client =
109+ AdminClientBuilder . builder()
110+ .setRegion(region)
111+ .build()) {
112+ client. createTopic(topic). get();
113+ }
113114```
114115
115116#### Publishing messages
@@ -217,11 +218,12 @@ Subscription.newBuilder()
217218 .setTopic(topicPath. value())
218219 .build();
219220
220- AdminClient client = AdminClientBuilder . builder()
221- .setRegion(region)
222- .setExecutor(executor)
223- .build();
224- client. createSubscription(subscription). get();
221+ try (AdminClient client =
222+ AdminClientBuilder . builder()
223+ .setRegion(region)
224+ .build()) {
225+ client. createSubscription(subscription). get();
226+ }
225227```
226228
227229#### Receiving messages
You can’t perform that action at this time.
0 commit comments