我之前使用 RestFB 将 facebook 功能添加到我的 spring 应用程序中。现在我开始使用Spring Social,因为它似乎很容易开发。
目前我正在为 spring social 中的 facebook 游戏开发后端应用程序,我需要获取一群用户的公开帖子。我可以在 restfb 中按如下方式执行此操作
FacebookClient facebookClient = new DefaultFacebookClient(accessToken);
List<BatchRequest> batchRequests = new ArrayList<BatchRequest>();
for (User user : users) {
BatchRequestBuilder requstBuilder = new BatchRequestBuilder(
user.getFbUid() + "/posts");
requstBuilder.parameters(Parameter.with("limit", limit));
batchRequests.add(requstBuilder.build());
}
List<BatchResponse> batchResponses = facebookClient.executeBatch(
batchRequests, Collections.<BinaryAttachment> emptyList());
但是我在 Spring Social 中找不到任何这样的方法来处理 Facebook Graph API 接受的批处理请求。
我怎样才能做到这一点?请帮我。
最佳答案
我在 JIRA issue 上的回复:
As mentioned in earlier comments, I have a fairly workable prototype for this. It is, however, just a prototype and would need more vetting to know if it's ready to work into the Spring Social Facebook project.
Specifically, it works great for a given Facebook API binding instance...which means it works great when batching requests for a single user. It does not, however, account for batch requests that span multiple users. This will certainly require a bit of rethinking of my prototype.
I was hoping to get this into Spring Social Facebook 1.1.0, but due to a tight schedule to push 1.1.0, I will need to push this off for post-1.1.0. I don't wish to try to rush this, as it's important that it is done right.
FWIW, I believe this is an important feature. But so far we've seen limited interest in it from only a few community members. The JIRA issue has only a single vote. Therefore, even if I believe it's important, it's difficult to justify holding up a release.
关于java - Spring Social中如何进行facebook批量请求处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21981842/