in flink-connector-gcp-pubsub/src/main/java/org/apache/flink/streaming/connectors/gcp/pubsub/PubSubSink.java [299:311]
public PubSubSink<IN> build() throws IOException {
if (credentials == null) {
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();
}
}
return new PubSubSink<>(
credentials, serializationSchema, projectName, topicName, hostAndPort);
}