rmetzger commented on a change in pull request #12846:
URL: https://github.com/apache/flink/pull/12846#discussion_r457381278



##########
File path: 
flink-connectors/flink-connector-gcp-pubsub/src/main/java/org/apache/flink/streaming/connectors/gcp/pubsub/PubSubSink.java
##########
@@ -273,7 +290,13 @@ private PubSubSinkBuilder(SerializationSchema<IN> 
serializationSchema) {
                 */
                public PubSubSink<IN> build() throws IOException {
                        if (credentials == null) {
-                               credentials = 
defaultCredentialsProviderBuilder().build().getCredentials();
+                               if (hostAndPort == null) {
+                                       // No hostAndPort is the normal 
scenario so we use the default credentials.
+                                       credentials = 
defaultCredentialsProviderBuilder().build().getCredentials();
+                               } else {
+                                       // With hostAndPort the PubSub emulator 
is used so we do not have credentials.
+                                       credentials = 
EmulatorCredentials.getInstance();
+                               }

Review comment:
       Again, I guess credentials handling should be done outside of the 
connector (so that we can pass different credentials for the test)




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