简体   繁体   English

通过 AWS SDK for Java 获取 SNS 中某个主题下的订阅列表

[英]Getting the subscription list under a topic in SNS via AWS SDK for Java

I have working on a project where I have to get the list of all the endpoint subscriptions that happened under the Application in AWS SNS Application.我正在处理一个项目,在该项目中,我必须获取在 AWS SNS 应用程序中的应用程序下发生的所有端点订阅的列表。

ListEndpointsByPlatformApplicationRequest request = new ListEndpointsByPlatformApplicationRequest();
request.setPlatformApplicationArn(applicationArn);

ListEndpointsByPlatformApplicationResult result = sns.listEndpointsByPlatformApplication(request);
List<Endpoint> endpoints = result.getEndpoints();
for(Endpoint endpoint : result.getEndpoints()){
    //System.out.println(endpoint.getEndpointArn());
    count++;
}

The count always is 100 and the list that comes is also same I checked it via printing and getting the data out of it.计数始终为 100,并且出现的列表也相同,我通过打印检查并从中获取数据。

Where am I doing wrong.我哪里做错了。 I know there is something connected with the token that we get using getNextToken() function but unable to do it.我知道有一些东西与我们使用getNextToken()函数获得的令牌有关,但无法做到。

Please help how to get the total number of endpoint subscription under an Application in SNS via AWS SDK using Java.请帮助如何使用 Java 通过 AWS SDK 获取 SNS 中应用程序下的端点订阅总数。

Thanks Ankur :)谢谢安库尔:)

You need to use the returned token to return the next page of results as detailed需要使用返回的token返回下一页结果详细说明

So your next request would be:所以你的下一个请求是:

String token = tokenFromPreviousRequest();
ListEndpointsByPlatformApplicationRequest request = 
    new ListEndpointsByPlatformApplicationRequest();
request.setPlatformApplicationArn(applicationArn);
request.setNextToken(token);

ListEndpointsByPlatformApplicationResult result = 
    sns.listEndpointsByPlatformApplication(request);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM