当前位置: 首页>>代码示例>>Java>>正文


Java ListTopicsResult.getNextToken方法代码示例

本文整理汇总了Java中com.amazonaws.services.sns.model.ListTopicsResult.getNextToken方法的典型用法代码示例。如果您正苦于以下问题:Java ListTopicsResult.getNextToken方法的具体用法?Java ListTopicsResult.getNextToken怎么用?Java ListTopicsResult.getNextToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.amazonaws.services.sns.model.ListTopicsResult的用法示例。


在下文中一共展示了ListTopicsResult.getNextToken方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getOrCreateNotification

import com.amazonaws.services.sns.model.ListTopicsResult; //导入方法依赖的package包/类
/**
 * 
 * @param email
 * @return
 */
public String getOrCreateNotification(String email) {
    String ret = null;
    String topicName = getTopicName(email);
    String nextToken = null;
    do {
        ListTopicsResult listTopics = asyncSnsClient.listTopics(nextToken);
        List<Topic> topics = listTopics.getTopics();
        for (Topic s : topics) {
            if (s.getTopicArn().endsWith(topicName)) {
                ret = s.getTopicArn();
                break;
            }
        }
        nextToken = listTopics.getNextToken();
    } while (ret == null && nextToken != null);
    if (ret == null) {
        // create the topic and the subscription
        CreateTopicResult topic = asyncSnsClient.createTopic(topicName);
        SubscribeRequest req = new SubscribeRequest(topic.getTopicArn(), "email", email);
        asyncSnsClient.subscribeAsync(req);
        ret = topic.getTopicArn();
    }

    return ret;
}
 
开发者ID:intuit,项目名称:Tank,代码行数:31,代码来源:CloudwatchInstance.java

示例2: topicsAreReturnedInChunksOf100

import com.amazonaws.services.sns.model.ListTopicsResult; //导入方法依赖的package包/类
@Test
public void topicsAreReturnedInChunksOf100() {
    for (int i = 0; i < 120; i++)
        sns.createTopic("topic" + i);
    ListTopicsResult result = sns.listTopics();

    final String token = result.getNextToken();
    assertThat(token).isNotNull();
    assertThat(arnValues(result.getTopics()))
            .hasSize(100)
            .contains(
                    "arn:aws:sns:us-east-1:12345:topic0",
                    "arn:aws:sns:us-east-1:12345:topic1",
                    "arn:aws:sns:us-east-1:12345:topic10",
                    "arn:aws:sns:us-east-1:12345:topic100",
                    "arn:aws:sns:us-east-1:12345:topic8",
                    "arn:aws:sns:us-east-1:12345:topic80")
            .doesNotContain(
                    "arn:aws:sns:us-east-1:12345:topic9");

    result = sns.listTopics(token);
    assertThat(result.getNextToken()).isNull();
    assertThat(arnValues(result.getTopics()))
            .hasSize(20)
            .contains(
                    "arn:aws:sns:us-east-1:12345:topic81",
                    "arn:aws:sns:us-east-1:12345:topic9",
                    "arn:aws:sns:us-east-1:12345:topic90",
                    "arn:aws:sns:us-east-1:12345:topic99")
            .doesNotContain(
                    "arn:aws:sns:us-east-1:12345:topic120");
}
 
开发者ID:OpenG,项目名称:aws-java-sdk,代码行数:33,代码来源:AmazonSNSFakeListTopicsTest.java

示例3: topicArnForName

import com.amazonaws.services.sns.model.ListTopicsResult; //导入方法依赖的package包/类
private String topicArnForName(final String name) {
    String nextToken = null;
    String topicArn = null;
    while (topicArn == null) {
        final ListTopicsResult listTopicsResult = amazonSnsClient.listTopics(nextToken);
        topicArn = topicArnForNameInTopics(name, listTopicsResult.getTopics());
        nextToken = listTopicsResult.getNextToken();
        if (nextToken == null) {
            break;
        }
    }
    return topicArn;
}
 
开发者ID:travel-cloud,项目名称:Cheddar,代码行数:14,代码来源:DefaultSnsTopicResourceFactory.java


注:本文中的com.amazonaws.services.sns.model.ListTopicsResult.getNextToken方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。