You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/06/04 18:57:30 UTC

[GitHub] [beam] damccorm opened a new issue, #20675: PubsubIO can't provide PubsubClientFactory

damccorm opened a new issue, #20675:
URL: https://github.com/apache/beam/issues/20675

   PubsubIO provides a method to pass the PubsubClientFactory.
   ```
   
   /**
    * The default client to write to Pub/Sub is the {@link PubsubJsonClient}, created by the {@link
   
   * PubsubJsonClient.PubsubJsonClientFactory}. This function allows to change the Pub/Sub client
    * by
   providing another {@link PubsubClient.PubsubClientFactory} like the {@link
    * PubsubGrpcClientFactory}.
   
   */
   public Read<T> withClientFactory(PubsubClient.PubsubClientFactory factory) {
     return toBuilder().setPubsubClientFactory(factory).build();
   }
   
   ```
   
   The comment here explains that can pass a PubsubClient.
   
   However, the IncomingMessage used in the {color:#ff0000}pull(){color} method of PubsubClient's abstract method is actually an abstract internal class, in other words, the abstract class PubsubClient can't be extended in external of the {color:#ff0000}org.apache.beam.sdk.io.gcp.pubsub{color} package.
   
   To overcome the above problem, I created the org.apache.beam.sdk.io.gcp.pubsub directory to extend PubsubClient and passes it to the {color:#ff0000}PubsubIO.withClientFactory{color} method.
   
   This seems to run locally without any problems, but when I submit my job to Dataflow, the withClientFactory method is useless and be replaced with the default PubsubJsonClientFactory.
   
   Imported from Jira [BEAM-10936](https://issues.apache.org/jira/browse/BEAM-10936). Original Jira may contain additional context.
   Reported by: j.zheng.


-- 
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.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org