我们如何远程使用 Google Datastore Objectify?
How can we use Google Datastore Objectify remotely?
我正在尝试使用 Google Objectify for Datastore (https://github.com/objectify/objectify)。我的应用程序未托管在 GAE 上,但我仍在使用 Datastore,因此我需要使用远程 API。现在,我使用低级别 API 并像这样成功连接:
DatastoreOptions options = DatastoreOptions.builder()
.projectId("PROJECT_NAME")
.authCredentials(AuthCredentials.createApplicationDefaults()).build();
Datastore client = options.service();
并且使用的库是http://googlecloudplatform.github.io/gcloud-java/0.2.0/index.html。我的 "AuthCredentials.createApplicationDefaults()" 应用程序默认位于我的开发主文件夹中以及服务器上。
在我看到的 Objectify 文档中,我没有看到像上面那样指定连接,因此无法告诉我们使用主文件夹中的凭据文件。我看到的 Objectify 的代码大多是这样的 Objectify.ofy()
。所以我看不出这种告诉使用默认身份验证凭据的方法。
非常感谢。
使用 Google App Engine 远程 api:
https://cloud.google.com/appengine/docs/java/tools/remoteapi
您可以尝试 gcloud-java 数据存储模块。
http://googlecloudplatform.github.io/gcloud-java/0.2.0/index.html
但我在 Google 沙箱(GAE-Compute Engine)
之外遇到了一些性能问题
我正在尝试使用 Google Objectify for Datastore (https://github.com/objectify/objectify)。我的应用程序未托管在 GAE 上,但我仍在使用 Datastore,因此我需要使用远程 API。现在,我使用低级别 API 并像这样成功连接:
DatastoreOptions options = DatastoreOptions.builder()
.projectId("PROJECT_NAME")
.authCredentials(AuthCredentials.createApplicationDefaults()).build();
Datastore client = options.service();
并且使用的库是http://googlecloudplatform.github.io/gcloud-java/0.2.0/index.html。我的 "AuthCredentials.createApplicationDefaults()" 应用程序默认位于我的开发主文件夹中以及服务器上。
在我看到的 Objectify 文档中,我没有看到像上面那样指定连接,因此无法告诉我们使用主文件夹中的凭据文件。我看到的 Objectify 的代码大多是这样的 Objectify.ofy()
。所以我看不出这种告诉使用默认身份验证凭据的方法。
非常感谢。
使用 Google App Engine 远程 api:
https://cloud.google.com/appengine/docs/java/tools/remoteapi
您可以尝试 gcloud-java 数据存储模块。
http://googlecloudplatform.github.io/gcloud-java/0.2.0/index.html
但我在 Google 沙箱(GAE-Compute Engine)
之外遇到了一些性能问题