com.amazonaws.services.sqs.model.ListQueuesRequest Java Examples
The following examples show how to use
com.amazonaws.services.sqs.model.ListQueuesRequest.
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: TestSQSEventQueueProvider.java From conductor with Apache License 2.0 | 6 votes |
@Test public void testGetQueueWithCustomConfiguration() { when(configuration.getIntProperty(eq("workflow.event.queues.sqs.batchSize"), anyInt())).thenReturn(10); when(configuration.getIntProperty(eq("workflow.event.queues.sqs.pollTimeInMS"), anyInt())).thenReturn(50); when(configuration.getIntProperty(eq("workflow.event.queues.sqs.visibilityTimeoutInSeconds"), anyInt())).thenReturn(30); ListQueuesResult listQueuesResult = new ListQueuesResult().withQueueUrls("test_queue_1"); when(amazonSQSClient.listQueues(any(ListQueuesRequest.class))).thenReturn(listQueuesResult); SQSEventQueueProvider sqsEventQueueProvider = new SQSEventQueueProvider(amazonSQSClient, configuration); SQSObservableQueue sqsObservableQueue = (SQSObservableQueue) sqsEventQueueProvider.getQueue("test_queue_1"); assertNotNull(sqsObservableQueue); assertEquals(10, sqsObservableQueue.getBatchSize()); assertEquals(50, sqsObservableQueue.getPollTimeInMS()); assertEquals(30, sqsObservableQueue.getVisibilityTimeoutInSeconds()); }
Example #2
Source File: MockSQS.java From amazon-sqs-java-temporary-queues-client with Apache License 2.0 | 5 votes |
@Override public ListQueuesResult listQueues(ListQueuesRequest request) { String prefix = request.getQueueNamePrefix(); String searchPrefix = prefix == null ? "" : prefix; List<String> queueUrls = queues.keySet().stream() .filter(name -> name.startsWith(searchPrefix)) .map(name -> accountPrefix + name) .collect(Collectors.toList()); return new ListQueuesResult().withQueueUrls(queueUrls); }
Example #3
Source File: SQSObservableQueue.java From conductor with Apache License 2.0 | 5 votes |
private List<String> listQueues(String queueName) { ListQueuesRequest listQueuesRequest = new ListQueuesRequest().withQueueNamePrefix(queueName); ListQueuesResult resultList = client.listQueues(listQueuesRequest); return resultList.getQueueUrls().stream() .filter(queueUrl -> queueUrl.contains(queueName)) .collect(Collectors.toList()); }
Example #4
Source File: TestSQSObservableQueue.java From conductor with Apache License 2.0 | 5 votes |
@Test public void testException() { com.amazonaws.services.sqs.model.Message message = new com.amazonaws.services.sqs.model.Message().withMessageId("test") .withBody("") .withReceiptHandle("receiptHandle"); Answer<?> answer = (Answer<ReceiveMessageResult>) invocation -> new ReceiveMessageResult(); AmazonSQSClient client = mock(AmazonSQSClient.class); when(client.listQueues(any(ListQueuesRequest.class))).thenReturn(new ListQueuesResult().withQueueUrls("junit_queue_url")); when(client.receiveMessage(any(ReceiveMessageRequest.class))).thenThrow(new RuntimeException("Error in SQS communication")) .thenReturn(new ReceiveMessageResult().withMessages(message)) .thenAnswer(answer); SQSObservableQueue queue = new SQSObservableQueue.Builder() .withQueueName("junit") .withClient(client).build(); List<Message> found = new LinkedList<>(); Observable<Message> observable = queue.observe(); assertNotNull(observable); observable.subscribe(found::add); Uninterruptibles.sleepUninterruptibly(1000, TimeUnit.MILLISECONDS); assertEquals(1, found.size()); }
Example #5
Source File: TestSQSEventQueueProvider.java From conductor with Apache License 2.0 | 5 votes |
@Test public void testGetQueueWithDefaultConfiguration() { when(configuration.getIntProperty(anyString(), anyInt())).thenAnswer(invocation -> invocation.getArguments()[1]); ListQueuesResult listQueuesResult = new ListQueuesResult().withQueueUrls("test_queue_1"); when(amazonSQSClient.listQueues(any(ListQueuesRequest.class))).thenReturn(listQueuesResult); SQSEventQueueProvider sqsEventQueueProvider = new SQSEventQueueProvider(amazonSQSClient, configuration); SQSObservableQueue sqsObservableQueue = (SQSObservableQueue) sqsEventQueueProvider.getQueue("test_queue_1"); assertNotNull(sqsObservableQueue); assertEquals(1, sqsObservableQueue.getBatchSize()); assertEquals(100, sqsObservableQueue.getPollTimeInMS()); assertEquals(60, sqsObservableQueue.getVisibilityTimeoutInSeconds()); }
Example #6
Source File: SQSImpl.java From aws-sdk-java-resources with Apache License 2.0 | 5 votes |
@Override public QueueCollection getQueues(ListQueuesRequest request) { ResourceCollectionImpl result = service.getCollection("Queues", request); if (result == null) return null; return new QueueCollectionImpl(result); }
Example #7
Source File: AbstractAmazonSQSClientWrapper.java From amazon-sqs-java-temporary-queues-client with Apache License 2.0 | 4 votes |
@Override public ListQueuesResult listQueues(ListQueuesRequest request) { request.getRequestClientOptions().appendUserAgent(userAgent); return amazonSqsToBeExtended.listQueues(request); }
Example #8
Source File: AbstractAmazonSQSClientWrapperTest.java From amazon-sqs-java-temporary-queues-client with Apache License 2.0 | 4 votes |
@Test public void listQueues() { assertWrappedMethod(AmazonSQS::listQueues, new ListQueuesRequest()); }
Example #9
Source File: AbstractAmazonSQSClientWrapperTest.java From amazon-sqs-java-temporary-queues-client with Apache License 2.0 | 4 votes |
@Test public void getCachedResponseMetadata() { ListQueuesRequest request = new ListQueuesRequest(); wrapper.getCachedResponseMetadata(request); verify(wrapped).getCachedResponseMetadata(request); }
Example #10
Source File: SQSImpl.java From aws-sdk-java-resources with Apache License 2.0 | 4 votes |
@Override public QueueCollection getQueues(String queueNamePrefix) { return getQueues( new ListQueuesRequest(queueNamePrefix)); }
Example #11
Source File: SQSImpl.java From aws-sdk-java-resources with Apache License 2.0 | 4 votes |
@Override public QueueCollection getQueues() { return getQueues((ListQueuesRequest)null); }
Example #12
Source File: AmazonSQSExtendedClientBase.java From amazon-sqs-java-extended-client-lib with Apache License 2.0 | 2 votes |
/** * <p> * Returns a list of your queues. The maximum number of queues that can be * returned is 1000. If you specify a value for the optional * <code>QueueNamePrefix</code> parameter, only queues with a name beginning * with the specified value are returned. * </p> * * @param listQueuesRequest * Container for the necessary parameters to execute the * ListQueues service method on AmazonSQS. * * @return The response from the ListQueues service method, as returned by * AmazonSQS. * * * @throws AmazonClientException * If any internal errors are encountered inside the client * while attempting to make the request or handle the response. * For example if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonSQS indicating * either a problem with the data in the request, or a server * side issue. */ public ListQueuesResult listQueues(ListQueuesRequest listQueuesRequest) throws AmazonServiceException, AmazonClientException { return amazonSqsToBeExtended.listQueues(listQueuesRequest); }
Example #13
Source File: SQS.java From aws-sdk-java-resources with Apache License 2.0 | 2 votes |
/** * Retrieves the Queues collection referenced by this resource. */ QueueCollection getQueues(ListQueuesRequest request);