Search in sources :

Example 1 with SQSObservableQueue

use of com.netflix.conductor.contribs.queue.sqs.SQSObservableQueue in project conductor by Netflix.

the class TestSQSEventQueueProvider method testGetQueueWithCustomConfiguration.

@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, Schedulers.from(Executors.newSingleThreadExecutor()));
    SQSObservableQueue sqsObservableQueue = (SQSObservableQueue) sqsEventQueueProvider.getQueue("test_queue_1");
    assertNotNull(sqsObservableQueue);
    assertEquals(10, sqsObservableQueue.getBatchSize());
    assertEquals(50, sqsObservableQueue.getPollTimeInMS());
    assertEquals(30, sqsObservableQueue.getVisibilityTimeoutInSeconds());
}
Also used : ListQueuesResult(com.amazonaws.services.sqs.model.ListQueuesResult) SQSObservableQueue(com.netflix.conductor.contribs.queue.sqs.SQSObservableQueue) ListQueuesRequest(com.amazonaws.services.sqs.model.ListQueuesRequest) Test(org.junit.Test)

Example 2 with SQSObservableQueue

use of com.netflix.conductor.contribs.queue.sqs.SQSObservableQueue in project conductor by Netflix.

the class TestSQSEventQueueProvider method testGetQueueWithDefaultConfiguration.

@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, Schedulers.from(Executors.newSingleThreadExecutor()));
    SQSObservableQueue sqsObservableQueue = (SQSObservableQueue) sqsEventQueueProvider.getQueue("test_queue_1");
    assertNotNull(sqsObservableQueue);
    assertEquals(1, sqsObservableQueue.getBatchSize());
    assertEquals(100, sqsObservableQueue.getPollTimeInMS());
    assertEquals(60, sqsObservableQueue.getVisibilityTimeoutInSeconds());
}
Also used : ListQueuesResult(com.amazonaws.services.sqs.model.ListQueuesResult) SQSObservableQueue(com.netflix.conductor.contribs.queue.sqs.SQSObservableQueue) ListQueuesRequest(com.amazonaws.services.sqs.model.ListQueuesRequest) Test(org.junit.Test)

Aggregations

ListQueuesRequest (com.amazonaws.services.sqs.model.ListQueuesRequest)2 ListQueuesResult (com.amazonaws.services.sqs.model.ListQueuesResult)2 SQSObservableQueue (com.netflix.conductor.contribs.queue.sqs.SQSObservableQueue)2 Test (org.junit.Test)2