software.amazon.awssdk.services.sqs.model.GetQueueAttributesResponse Java Examples

The following examples show how to use software.amazon.awssdk.services.sqs.model.GetQueueAttributesResponse. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AwsSqsScannerTest.java    From clouditor with Apache License 2.0 5 votes vote down vote up
@BeforeAll
static void setUpOnce() throws IOException {
  discoverAssets(
      SqsClient.class,
      AwsSqsScanner::new,
      api -> {
        when(api.listQueues())
            .thenReturn(
                ListQueuesResponse.builder()
                    .queueUrls("123456789012/MyQueue1", "123456789012/MyQueue2")
                    .build());

        when(api.getQueueAttributes(
                GetQueueAttributesRequest.builder()
                    .queueUrl("123456789012/MyQueue1")
                    .attributeNames(QueueAttributeName.ALL)
                    .build()))
            .thenReturn(
                GetQueueAttributesResponse.builder()
                    .attributesWithStrings(Map.of("VisibilityTimeout", "30"))
                    .build());

        when(api.getQueueAttributes(
                GetQueueAttributesRequest.builder()
                    .queueUrl("123456789012/MyQueue2")
                    .attributeNames(QueueAttributeName.ALL)
                    .build()))
            .thenReturn(
                GetQueueAttributesResponse.builder()
                    .attributesWithStrings(Map.of("VisibilityTimeout", "60"))
                    .build());
      });
}
 
Example #2
Source File: SqsQueueManager.java    From quarkus with Apache License 2.0 5 votes vote down vote up
public Queue createQueue(String queueName) {
    CreateQueueResponse queueResp = client.createQueue(q -> q.queueName(queueName));
    GetQueueAttributesResponse queueAttributes = client
            .getQueueAttributes(a -> a.queueUrl(queueResp.queueUrl()).attributeNames(QueueAttributeName.QUEUE_ARN));

    Queue queue = new SqsQueueManager.Queue(queueResp.queueUrl(),
            queueAttributes.attributes().get(QueueAttributeName.QUEUE_ARN));
    queues.put(queueName, queue);
    return queue;
}