suztomo commented on a change in pull request #14578:
URL: https://github.com/apache/beam/pull/14578#discussion_r616713743



##########
File path: 
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsublite/Publishers.java
##########
@@ -35,24 +36,28 @@
   private Publishers() {}
 
   @SuppressWarnings("unchecked")
-  static Publisher<PublishMetadata> newPublisher(PublisherOptions options) 
throws ApiException {
+  static Publisher<MessageMetadata> newPublisher(PublisherOptions options) 
throws ApiException {
     SerializableSupplier<Object> supplier = options.publisherSupplier();
     if (supplier != null) {
       Object supplied = supplier.get();
-      TypeToken<Publisher<PublishMetadata>> token = new 
TypeToken<Publisher<PublishMetadata>>() {};
+      TypeToken<Publisher<MessageMetadata>> token = new 
TypeToken<Publisher<MessageMetadata>>() {};
       checkArgument(token.isSupertypeOf(supplied.getClass()));
-      return (Publisher<PublishMetadata>) supplied;
+      return (Publisher<MessageMetadata>) supplied;
     }
-    return new PartitionCountWatchingPublisher(
+
+    TopicPath topic = options.topicPath();
+    PartitionCountWatchingPublisherSettings.Builder publisherSettings =
         PartitionCountWatchingPublisherSettings.newBuilder()
-            .setTopic(options.topicPath())
+            .setTopic(topic)
             .setPublisherFactory(
                 partition ->
                     SinglePartitionPublisherBuilder.newBuilder()
-                        .setTopic(options.topicPath())
+                        .setTopic(topic)
                         .setPartition(partition)
-                        .setContext(PubsubContext.of(FRAMEWORK))
                         .build())
-            .build());
+            .setAdminClient(
+                AdminClient.create(
+                    
AdminClientSettings.newBuilder().setRegion(topic.location().region()).build()));
+    return publisherSettings.build().instantiate();

Review comment:
       Memo: the PartitionCountWatchingPublisher's constructor is now 
package-private. It's created via `publisherSettings.build().instantiate()`.
   
   from 
https://github.com/googleapis/java-pubsublite/pull/475/files#diff-08a30d0f50008bb0eb61bec22d712b52d2c7c5d3e1ad5f1d393265702708438dR197




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to