Add retry conig for gcp-datastore #2636
Description
GCP native java client allows to configure retries, but there is no way to do so if spring-data-datastore is used.
The native client is instantiated in a private method, so no way to change this. If a user defined Datastore bean with configured retries is exposed, this will not work because of namespaces. It is not possible to have both NamespaceProvider and Datastore at the same time. To add a custom datastore client, the entire namespace related instantiation logic have to be copied on user side. Suggestion is to add RestryConfigurationProperties read config from it and configure in getDatastore() method:
` private Datastore getDatastore(String namespace) {
DatastoreOptions.Builder builder = DatastoreOptions.newBuilder()
.setProjectId(this.projectId)
.setRetrySettings(getRetrySettings())//the magic happens here
.setHeaderProvider(new UserAgentHeaderProvider(this.getClass()))
.setCredentials(this.credentials);
if (namespace != null) {
builder.setNamespace(namespace);
}
if (this.host != null) {
builder.setHost(this.host);
}
return builder.build().getService();
}`