/** * Simplified method form for invoking the GetQueueUrl operation. * * @see #getQueueUrlAsync(GetQueueUrlRequest) */ @Override public java.util.concurrent.Future<GetQueueUrlResult> getQueueUrlAsync(String queueName) { return getQueueUrlAsync(new GetQueueUrlRequest().withQueueName(queueName)); }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getQueueName() == null) ? 0 : getQueueName().hashCode()); hashCode = prime * hashCode + ((getQueueOwnerAWSAccountId() == null) ? 0 : getQueueOwnerAWSAccountId().hashCode()); return hashCode; }
/** * Constructs a new GetQueueUrlRequest object. Callers should use the setter or fluent setter (with...) methods to * initialize any additional object members. * * @param queueName * The name of the queue whose URL must be fetched. Maximum 80 characters. Valid values: alphanumeric * characters, hyphens (<code>-</code>), and underscores (<code>_</code>).</p> * <p> * Queue URLs and names are case-sensitive. */ public GetQueueUrlRequest(String queueName) { setQueueName(queueName); }
@Override public Future<GetQueueUrlResult> getQueueUrlAsync(String queueName, AsyncHandler<GetQueueUrlRequest, GetQueueUrlResult> asyncHandler) { return getQueueUrlAsync(new GetQueueUrlRequest(queueName), asyncHandler); }
GetQueueUrlRequest getQueueUrlRequest = new GetQueueUrlRequest(); getQueueUrlRequest.setQueueName(queueName); return getQueueUrl(getQueueUrlRequest);
/** * Check if the requested queue exists. This function calls * <code>GetQueueUrl</code> for the given queue name with the given owner * accountId, returning true on success, false if it gets * <code>QueueDoesNotExistException</code>. * * @param queueName * the queue to check * @param queueOwnerAccountId * The AWS accountId of the account that created the queue * @return true if the queue exists, false if it doesn't. * @throws JMSException */ public boolean queueExists(String queueName, String queueOwnerAccountId) throws JMSException { try { GetQueueUrlRequest getQueueUrlRequest = new GetQueueUrlRequest(queueName); getQueueUrlRequest.setQueueOwnerAWSAccountId(queueOwnerAccountId); prepareRequest(getQueueUrlRequest); amazonSQSClient.getQueueUrl(getQueueUrlRequest); return true; } catch (QueueDoesNotExistException e) { return false; } catch (AmazonClientException e) { throw handleException(e, "getQueueUrl"); } }
/** * Gets the queueUrl of a queue given a queue name owned by the provided accountId. * * @param queueName * @param queueOwnerAccountId The AWS accountId of the account that created the queue * @return The response from the GetQueueUrl service method, as returned by * AmazonSQS, which will include queue`s URL * @throws JMSException */ public GetQueueUrlResult getQueueUrl(String queueName, String queueOwnerAccountId) throws JMSException { return getQueueUrl(new GetQueueUrlRequest(queueName).withQueueOwnerAWSAccountId(queueOwnerAccountId)); }
@Bean public AmazonSQSAsync amazonSqs() { AmazonSQSAsync amazonSqs = mock(AmazonSQSAsync.class); willAnswer(invocation -> { GetQueueUrlRequest getQueueUrlRequest = (GetQueueUrlRequest) invocation.getArguments()[0]; GetQueueUrlResult queueUrl = new GetQueueUrlResult(); queueUrl.setQueueUrl("http://queue-url.com/" + getQueueUrlRequest.getQueueName()); return queueUrl; }) .given(amazonSqs) .getQueueUrl(any(GetQueueUrlRequest.class)); willAnswer(invocation -> { CreateQueueRequest createQueueRequest = (CreateQueueRequest) invocation.getArguments()[0]; CreateQueueResult queueUrl = new CreateQueueResult(); queueUrl.setQueueUrl("http://queue-url.com/" + createQueueRequest.getQueueName()); return queueUrl; }) .given(amazonSqs) .createQueue(any(CreateQueueRequest.class)); return amazonSqs; }
/** * <p> * The AWS account ID of the account that created the queue. * </p> * * @param queueOwnerAWSAccountId * The AWS account ID of the account that created the queue. * @return Returns a reference to this object so that method calls can be chained together. */ public GetQueueUrlRequest withQueueOwnerAWSAccountId(String queueOwnerAWSAccountId) { setQueueOwnerAWSAccountId(queueOwnerAWSAccountId); return this; }
@Override public Future<GetQueueUrlResult> getQueueUrlAsync(String queueName) { return getQueueUrlAsync(new GetQueueUrlRequest(queueName)); }
GetQueueUrlRequest getQueueUrlRequest = new GetQueueUrlRequest(); getQueueUrlRequest.setQueueName(queueName); return getQueueUrl(getQueueUrlRequest);
GetQueueUrlRequest getQueueUrlRequest = new GetQueueUrlRequest(queueName); getQueueUrlRequest.setQueueOwnerAWSAccountId(queueOwnerAccountId); prepareRequest(getQueueUrlRequest); amazonSQSClient.getQueueUrl(getQueueUrlRequest);
/** * <p> * The AWS account ID of the account that created the queue. * </p> * * @param queueOwnerAWSAccountId * The AWS account ID of the account that created the queue. * @return Returns a reference to this object so that method calls can be chained together. */ public GetQueueUrlRequest withQueueOwnerAWSAccountId(String queueOwnerAWSAccountId) { setQueueOwnerAWSAccountId(queueOwnerAWSAccountId); return this; }
/** * Simplified method form for invoking the GetQueueUrl operation with an AsyncHandler. * * @see #getQueueUrlAsync(GetQueueUrlRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future<GetQueueUrlResult> getQueueUrlAsync(String queueName, com.amazonaws.handlers.AsyncHandler<GetQueueUrlRequest, GetQueueUrlResult> asyncHandler) { return getQueueUrlAsync(new GetQueueUrlRequest().withQueueName(queueName), asyncHandler); }
@Override public GetQueueUrlResult getQueueUrl(String queueName) throws AmazonServiceException, AmazonClientException { return getQueueUrl(new GetQueueUrlRequest(queueName)); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof GetQueueUrlRequest == false) return false; GetQueueUrlRequest other = (GetQueueUrlRequest) obj; if (other.getQueueName() == null ^ this.getQueueName() == null) return false; if (other.getQueueName() != null && other.getQueueName().equals(this.getQueueName()) == false) return false; if (other.getQueueOwnerAWSAccountId() == null ^ this.getQueueOwnerAWSAccountId() == null) return false; if (other.getQueueOwnerAWSAccountId() != null && other.getQueueOwnerAWSAccountId().equals(this.getQueueOwnerAWSAccountId()) == false) return false; return true; }
@Override public void init() { if (sqsClient == null) { // not injected sqsClient = new AmazonSQSClient(credentialsProvider, clientConfig); } String endpoint = "sqs." + this.region + ".amazonaws.com"; sqsClient.setEndpoint(endpoint); for (String queueName : queues) { GetQueueUrlRequest request = new GetQueueUrlRequest(); request.setQueueName(queueName); queueUrls.add(sqsClient.getQueueUrl(request).getQueueUrl()); } log.info(String.format("SQSNotice initialized with the endpoint: %s, queue: %s", endpoint, queues)); }
/** * <p> * The name of the queue whose URL must be fetched. Maximum 80 characters. Valid values: alphanumeric characters, * hyphens (<code>-</code>), and underscores (<code>_</code>). * </p> * <p> * Queue URLs and names are case-sensitive. * </p> * * @param queueName * The name of the queue whose URL must be fetched. Maximum 80 characters. Valid values: alphanumeric * characters, hyphens (<code>-</code>), and underscores (<code>_</code>).</p> * <p> * Queue URLs and names are case-sensitive. * @return Returns a reference to this object so that method calls can be chained together. */ public GetQueueUrlRequest withQueueName(String queueName) { setQueueName(queueName); return this; }
/** * Simplified method form for invoking the GetQueueUrl operation with an AsyncHandler. * * @see #getQueueUrlAsync(GetQueueUrlRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future<GetQueueUrlResult> getQueueUrlAsync(String queueName, com.amazonaws.handlers.AsyncHandler<GetQueueUrlRequest, GetQueueUrlResult> asyncHandler) { return getQueueUrlAsync(new GetQueueUrlRequest().withQueueName(queueName), asyncHandler); }
@Override public GetQueueUrlResult getQueueUrl(String queueName) throws AmazonServiceException, AmazonClientException { return getQueueUrl(new GetQueueUrlRequest(queueName)); }