You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.
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:
@NorthernDarkness Would the retry properties need to be unique for each namespace, or global across the application?
Either way would involve adding properties to GcpDatastoreProperties (either simple properties or a map of them) and using them in GcpDatastoreAutoConfiguration.
Would you be interested in contributing a PR for this?
This looks natural to have retry settings global for all namespaces because a client is not aware which specific cluster in google data center handles a specific namespace request, so no reason to control it separately.
This change certainly requires a new items in GcpDatastoreProperties(or probably just create a common RetryProperties to share with other GCP products as retry settings are basically the same across all GCP native clients )
I can try to make a draft and push it later next week maybe.
One thing we can do is expose DatastoreOptions.Builder that Datastore getDatastore(String namespace) uses as a bean that can be overwritten. Alternatively, we can create a factory interface that takes a namespace and produces a Datastore object.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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);
}
The text was updated successfully, but these errors were encountered: