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


Java ListQueuesResult.getQueueUrls方法代码示例

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


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

示例1: generateCurrentQueueName

import com.amazonaws.services.sqs.model.ListQueuesResult; //导入方法依赖的package包/类
/**
 *  Each test creates its own uniquely named queue in SQS and then deletes it afterwards.
 *  We try to scrub any leftover queues from the previous runs just in case tests were
 * aborted
 *
 * @param currentQueueNamePrefix
 */
public void generateCurrentQueueName(String currentQueueNamePrefix)
{
  if (validateTestCreds()) {
    ListQueuesResult list = sqs.listQueues(currentQueueNamePrefix);
    for (String url : list.getQueueUrls()) {
      sqs.deleteQueue(url);
    }
  }
  this.currentQueueName = currentQueueNamePrefix + System.currentTimeMillis();
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:18,代码来源:SQSTestBase.java

示例2: connectToQueue

import com.amazonaws.services.sqs.model.ListQueuesResult; //导入方法依赖的package包/类
/**
 * Note here we attempt to the TOCQueue which may take some time to be shown as available
 * @param isConsumer
 * @param maxAttempts
 * @throws Exception
 */
public void connectToQueue(boolean isConsumer, int maxAttempts) throws Exception{
	
	for (int i=0; i<maxAttempts; i++) {
		
		logger.debug("connectToQueue() attempt: " + (i+1));
		
		ListQueuesResult queuesResult = sqsClient.listQueues();
		if (queuesResult != null) {
			for (String queueUrl : queuesResult.getQueueUrls()) {
				if (queueUrl.indexOf(sqsQueueName) != -1) {
					tocQueueUrl = queueUrl;
					break;
				}
			}
		}
		
		// if consumer, retry, otherwise is master, so just exit quick to create...
		if (tocQueueUrl == null && isConsumer) {
			Thread.currentThread().sleep(1000);
			continue;
		} else {
			break; // exit;
		}
	}
	
	if (tocQueueUrl == null && !isConsumer) {
		CreateQueueResult createQueueResult = sqsClient.createQueue(sqsQueueName);
		this.tocQueueUrl = createQueueResult.getQueueUrl();
		
	} else if (tocQueueUrl == null) {
		throw new Exception("TOCQueue() isConsumer:"+ isConsumer+ " cannot start, sqsQueueName has yet to be created by master?: " + sqsQueueName);
	}
}
 
开发者ID:bitsofinfo,项目名称:s3-bucket-loader,代码行数:40,代码来源:TOCQueue.java

示例3: doStart

import com.amazonaws.services.sqs.model.ListQueuesResult; //导入方法依赖的package包/类
@Override
protected void doStart() throws Exception {
    client = getConfiguration().getAmazonSQSClient() != null
        ? getConfiguration().getAmazonSQSClient() : getClient();
        
    // Override the endpoint location
    if (ObjectHelper.isNotEmpty(getConfiguration().getAmazonSQSEndpoint())) {
        client.setEndpoint(getConfiguration().getAmazonSQSEndpoint());
    }
    
    // check the setting the headerFilterStrategy
    if (headerFilterStrategy == null) {
        headerFilterStrategy = new SqsHeaderFilterStrategy();
    }

    // If both region and Account ID is provided the queue URL can be built manually.
    // This allows accessing queues where you don't have permission to list queues or query queues
    if (configuration.getRegion() != null && configuration.getQueueOwnerAWSAccountId() != null) {
        queueUrl = "https://sqs." + configuration.getRegion() + ".amazonaws.com/"
            +  configuration.getQueueOwnerAWSAccountId() + "/" + configuration.getQueueName();
    } else if (configuration.getQueueOwnerAWSAccountId() != null) {
        GetQueueUrlRequest getQueueUrlRequest = new GetQueueUrlRequest();
        getQueueUrlRequest.setQueueName(configuration.getQueueName());
        getQueueUrlRequest.setQueueOwnerAWSAccountId(configuration.getQueueOwnerAWSAccountId());
        GetQueueUrlResult getQueueUrlResult = client.getQueueUrl(getQueueUrlRequest);
        queueUrl = getQueueUrlResult.getQueueUrl();
    } else {
        // check whether the queue already exists
        ListQueuesResult listQueuesResult = client.listQueues();
        for (String url : listQueuesResult.getQueueUrls()) {
            if (url.endsWith("/" + configuration.getQueueName())) {
                queueUrl = url;
                LOG.trace("Queue available at '{}'.", queueUrl);
                break;
            }
        }
    }

    if (queueUrl == null) {
        createQueue(client);
    } else {
        updateQueueAttributes(client);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:45,代码来源:SqsEndpoint.java

示例4: listQueues

import com.amazonaws.services.sqs.model.ListQueuesResult; //导入方法依赖的package包/类
public List<String> listQueues(){
    ListQueuesResult result= sqsClient.listQueues();
    return result.getQueueUrls();
}
 
开发者ID:SINTEF-9012,项目名称:cloudml,代码行数:5,代码来源:BeanstalkConnector.java


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