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


Java CreateQueueResult.getQueueUrl方法代码示例

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


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

示例1: initQueue

import com.amazonaws.services.sqs.model.CreateQueueResult; //导入方法依赖的package包/类
private void initQueue() {
	this.sqs = new AmazonSQSClient(); // Do we need to use new
										// ClientConfiguration().withMaxConnections(256)
										// ?
	this.sqs.configureRegion(region);
	try {
		// Check to see if queue exists
		GetQueueUrlResult queueUrlResult = this.sqs.getQueueUrl(getSqsQueueName());
		this.queueUrl = queueUrlResult.getQueueUrl();
	} catch (QueueDoesNotExistException queueDoesNotExist) {
		// Queue does not exist, need to create one
		CreateQueueRequest createQueueRequest = new CreateQueueRequest();
		createQueueRequest.setQueueName(getSqsQueueName());
		createQueueRequest.addAttributesEntry("VisibilityTimeout", "" + getVisibilityTimeout());
		CreateQueueResult createQueueResult = this.sqs.createQueue(createQueueRequest);
		this.queueUrl = createQueueResult.getQueueUrl();
	}
}
 
开发者ID:olegdulin,项目名称:sqs-retryqueue,代码行数:19,代码来源:SQSRetryQueue.java

示例2: initialize

import com.amazonaws.services.sqs.model.CreateQueueResult; //导入方法依赖的package包/类
@Override
public void initialize(JSONObject config) throws Exception {
    String endpoint = config.getString(PARAM_ENDPOINT);
    String queueName = config.getString(GenericQueue.PARAM_NAME);
    String accessKey = config.getString(PARAM_ACCESS_KEY);
    String secretKey = config.getString(PARAM_SECRET_KEY);
    if(accessKey==null) throw new Exception(PARAM_ACCESS_KEY+" is required!");
    if(secretKey==null) throw new Exception(PARAM_SECRET_KEY+" is required!");
    try {
        this.client = new AmazonSQSAsyncClient(new BasicAWSCredentials(accessKey,secretKey));
        this.client.setEndpoint(endpoint);
        CreateQueueRequest createQueueRequest = new CreateQueueRequest(queueName);
        CreateQueueResult createQueueResult = this.client.createQueue(createQueueRequest);
        this.queueUrl = createQueueResult.getQueueUrl();
    } catch (Throwable e){
        throw new Exception(e);
    }
}
 
开发者ID:mychaelstyle,项目名称:generic-queue,代码行数:19,代码来源:AwsSQS.java

示例3: resolveDestination

import com.amazonaws.services.sqs.model.CreateQueueResult; //导入方法依赖的package包/类
@Override
public String resolveDestination(String name) throws DestinationResolutionException {
    String queueName = name;

    if (this.resourceIdResolver != null) {
        queueName = this.resourceIdResolver.resolveToPhysicalResourceId(name);
    }

    if (isValidQueueUrl(queueName)) {
        return queueName;
    }

    if (this.autoCreate) {
        //Auto-create is fine to be called even if the queue exists.
        CreateQueueResult createQueueResult = this.amazonSqs.createQueue(new CreateQueueRequest(queueName));
        return createQueueResult.getQueueUrl();
    } else {
        try {
            GetQueueUrlResult getQueueUrlResult = this.amazonSqs.getQueueUrl(new GetQueueUrlRequest(queueName));
            return getQueueUrlResult.getQueueUrl();
        } catch (QueueDoesNotExistException e) {
            throw new DestinationResolutionException(e.getMessage(), e);
        }
    }
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-aws,代码行数:26,代码来源:DynamicQueueUrlDestinationResolver.java

示例4: getOrCreateQueue

import com.amazonaws.services.sqs.model.CreateQueueResult; //导入方法依赖的package包/类
@VisibleForTesting
String getOrCreateQueue() {
       List<String> queueUrls = listQueues(queueName);
	if (queueUrls == null || queueUrls.isEmpty()) {			
           CreateQueueRequest createQueueRequest = new CreateQueueRequest().withQueueName(queueName);
           CreateQueueResult result = client.createQueue(createQueueRequest);
           return result.getQueueUrl();
	} else {
           return queueUrls.get(0);
       }
   }
 
开发者ID:Netflix,项目名称:conductor,代码行数:12,代码来源:SQSObservableQueue.java

示例5: Scanner

import com.amazonaws.services.sqs.model.CreateQueueResult; //导入方法依赖的package包/类
public Scanner(ScanConfig config) {
    opt = config;
    ProfileCredentialsProvider creds = new ProfileCredentialsProvider(opt.profile());
    creds.getCredentials(); // credible credential criteria
    s3 = new AmazonS3Client(creds);
    sqs = new AmazonSQSClient(creds);

    CreateQueueResult queueResult = sqs.createQueue(opt.queue());
    queueUrl = queueResult.getQueueUrl();

    filter = Pattern.compile(opt.filter(), Pattern.CASE_INSENSITIVE);
    max = Long.parseLong(opt.max());
}
 
开发者ID:jhy,项目名称:RekognitionS3Batch,代码行数:14,代码来源:Scanner.java

示例6: createQueue

import com.amazonaws.services.sqs.model.CreateQueueResult; //导入方法依赖的package包/类
protected void createQueue(AmazonSQS client) {
    LOG.trace("Queue '{}' doesn't exist. Will create it...", configuration.getQueueName());

    // creates a new queue, or returns the URL of an existing one
    CreateQueueRequest request = new CreateQueueRequest(configuration.getQueueName());
    if (getConfiguration().getDefaultVisibilityTimeout() != null) {
        request.getAttributes().put(QueueAttributeName.VisibilityTimeout.name(), String.valueOf(getConfiguration().getDefaultVisibilityTimeout()));
    }
    if (getConfiguration().getMaximumMessageSize() != null) {
        request.getAttributes().put(QueueAttributeName.MaximumMessageSize.name(), String.valueOf(getConfiguration().getMaximumMessageSize()));
    }
    if (getConfiguration().getMessageRetentionPeriod() != null) {
        request.getAttributes().put(QueueAttributeName.MessageRetentionPeriod.name(), String.valueOf(getConfiguration().getMessageRetentionPeriod()));
    }
    if (getConfiguration().getPolicy() != null) {
        request.getAttributes().put(QueueAttributeName.Policy.name(), String.valueOf(getConfiguration().getPolicy()));
    }
    if (getConfiguration().getReceiveMessageWaitTimeSeconds() != null) {
        request.getAttributes().put(QueueAttributeName.ReceiveMessageWaitTimeSeconds.name(), String.valueOf(getConfiguration().getReceiveMessageWaitTimeSeconds()));
    }
    if (getConfiguration().getRedrivePolicy() != null) {
        request.getAttributes().put(QueueAttributeName.RedrivePolicy.name(), getConfiguration().getRedrivePolicy());
    }
    LOG.trace("Creating queue [{}] with request [{}]...", configuration.getQueueName(), request);
    
    CreateQueueResult queueResult = client.createQueue(request);
    queueUrl = queueResult.getQueueUrl();
    
    LOG.trace("Queue created and available at: {}", queueUrl);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:31,代码来源:SqsEndpoint.java

示例7: produceMsg

import com.amazonaws.services.sqs.model.CreateQueueResult; //导入方法依赖的package包/类
public void produceMsg(String[] msgs, boolean purgeFirst) throws Exception
{
  CreateQueueResult res = sqs.createQueue(getCurrentQueueName());
  if (purgeFirst) {
    PurgeQueueRequest purgeReq = new PurgeQueueRequest(res.getQueueUrl());
    sqs.purgeQueue(purgeReq);
  }
  for (String text : msgs) {
    sqs.sendMessage(res.getQueueUrl(), text);
  }
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:12,代码来源:SQSTestBase.java

示例8: connectToQueue

import com.amazonaws.services.sqs.model.CreateQueueResult; //导入方法依赖的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

示例9: getQueueArnFromAttributes

import com.amazonaws.services.sqs.model.CreateQueueResult; //导入方法依赖的package包/类
public void getQueueArnFromAttributes() {
    String queueName = someQueueName();
    CreateQueueResult createQueueResult = _amazonSQS.createQueue(new CreateQueueRequest(queueName));
    String queueUrl = createQueueResult.getQueueUrl();

    List<String> requestedAttributes = ImmutableList.of("QueueArn");
    GetQueueAttributesResult getQueueAttributesResult = _amazonSQS.getQueueAttributes(new GetQueueAttributesRequest()
            .withQueueUrl(queueUrl)
            .withAttributeNames(requestedAttributes));
    Map<String, String> resultAttributes = getQueueAttributesResult.getAttributes();
    String queueArn = resultAttributes.get("QueueArn");
    String queueNameFromArn = queueArn.substring(queueArn.lastIndexOf(":") + 1);

    Assert.assertEquals(queueNameFromArn, queueName);
}
 
开发者ID:bazaarvoice,项目名称:awslocal,代码行数:16,代码来源:TestSQSClient.java

示例10: createQueueIfNotExists

import com.amazonaws.services.sqs.model.CreateQueueResult; //导入方法依赖的package包/类
private void createQueueIfNotExists() {
	for (String qUrl : sqsClient.listQueues().getQueueUrls()) {
		if (qUrl.contains(queueName)) {
			queueUrl = qUrl;
			break;
		}
	}
	if (queueUrl == null) {
		CreateQueueRequest request = new CreateQueueRequest(queueName);
		Map<String, String> queueAttributes = new HashMap<String, String>();
		queueAttributes.put("ReceiveMessageWaitTimeSeconds", Integer
				.valueOf(receiveMessageWaitTimeout).toString());
		if (messageDelay != null) {
			queueAttributes.put("DelaySeconds", messageDelay.toString());
		}
		if (maximumMessageSize != null) {
			queueAttributes.put("MaximumMessageSize",
					maximumMessageSize.toString());
		}
		if (messageRetentionPeriod != null) {
			queueAttributes.put("MessageRetentionPeriod",
					messageRetentionPeriod.toString());
		}
		if (visibilityTimeout != null) {
			queueAttributes.put("VisibilityTimeout",
					visibilityTimeout.toString());
		}
		request.setAttributes(queueAttributes);
		CreateQueueResult result = sqsClient.createQueue(request);
		queueUrl = result.getQueueUrl();
		log.debug("New queue available at: " + queueUrl);
	} else {
		log.debug("Queue already exists: " + queueUrl);
	}

	resolveQueueArn();
}
 
开发者ID:3pillarlabs,项目名称:spring-integration-aws,代码行数:38,代码来源:SqsExecutor.java

示例11: createMessageQueue

import com.amazonaws.services.sqs.model.CreateQueueResult; //导入方法依赖的package包/类
public String createMessageQueue(String queueName) {
	CreateQueueResult createQueueResult = sqsClient.createQueue(queueName);
	return createQueueResult.getQueueUrl();
}
 
开发者ID:TimShi,项目名称:s3_video,代码行数:5,代码来源:AWSAdapter.java

示例12: someNewQueue

import com.amazonaws.services.sqs.model.CreateQueueResult; //导入方法依赖的package包/类
private String someNewQueue() {
    final String queueName = someQueueName();
    final CreateQueueResult queue = _amazonSQS.createQueue(new CreateQueueRequest(queueName));
    return queue.getQueueUrl();
}
 
开发者ID:bazaarvoice,项目名称:awslocal,代码行数:6,代码来源:TestSQSClient.java

示例13: someNewQueue

import com.amazonaws.services.sqs.model.CreateQueueResult; //导入方法依赖的package包/类
private String someNewQueue() {
    final String queueName = someQueueName();
    final CreateQueueResult queue = _sqs1.createQueue(new CreateQueueRequest(queueName));
    return queue.getQueueUrl();
}
 
开发者ID:bazaarvoice,项目名称:awslocal,代码行数:6,代码来源:TestSQSClientCooperation.java

示例14: someNewQueue

import com.amazonaws.services.sqs.model.CreateQueueResult; //导入方法依赖的package包/类
private String someNewQueue(String queueName) {
    final CreateQueueResult queue = _amazonSQS1.createQueue(new CreateQueueRequest(queueName));
    return queue.getQueueUrl();
}
 
开发者ID:bazaarvoice,项目名称:awslocal,代码行数:5,代码来源:TestSNSClient.java

示例15: createQueue

import com.amazonaws.services.sqs.model.CreateQueueResult; //导入方法依赖的package包/类
public String createQueue(String name){
    CreateQueueRequest request=new CreateQueueRequest();
    request.setQueueName(name);
    CreateQueueResult res= sqsClient.createQueue(request);
    return res.getQueueUrl();
}
 
开发者ID:SINTEF-9012,项目名称:cloudml,代码行数:7,代码来源:BeanstalkConnector.java


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