@Test public void test_3Message() throws Exception { Message msg1 = createMessage(1); Message msg2 = createMessage(2); Message msg3 = createMessage(3); DeleteMessageRequest expectedDmr1 = createDeleteMessageRequest(1); DeleteMessageRequest expectedDmr2 = createDeleteMessageRequest(2); DeleteMessageRequest expectedDmr3 = createDeleteMessageRequest(3); when(sqs.receiveMessage(any(ReceiveMessageRequest.class))) .thenReturn(receiveMessageResultOf(msg1, msg2, msg3)); sut.loop(); verify(sqs).receiveMessage(any(ReceiveMessageRequest.class)); verify(messageHandler).accept(eq(msg1)); verify(messageHandler).accept(eq(msg2)); verify(messageHandler).accept(eq(msg3)); verify(sqs).deleteMessage(eq(expectedDmr1)); verify(sqs).deleteMessage(eq(expectedDmr2)); verify(sqs).deleteMessage(eq(expectedDmr3)); verify(sqs, never()).changeMessageVisibility(any(ChangeMessageVisibilityRequest.class)); }
@Scheduled(fixedDelay = 1) public void loop() { List<Message> messages = reveiveMessages(); if (messages.isEmpty()) { log.trace("No SQS message received"); return; } log.debug("{} SQS messages are received", messages.size()); messages.stream().parallel().forEach(this::handleMessage); }
SqsMessagePoller { @Scheduled(fixedDelay = 1) public void loop() { List<Message> messages = reveiveMessages(); if (messages.isEmpty()) { log.trace("No SQS message received"); return; } log.debug("{} SQS messages are received", messages.size()); messages.stream().parallel().forEach(this::handleMessage); } }
SqsMessagePoller { @Scheduled(fixedDelay = 1) public void loop() { List<Message> messages = reveiveMessages(); if (messages.isEmpty()) { log.trace("No SQS message received"); return; } log.debug("{} SQS messages are received", messages.size()); messages.stream().parallel().forEach(this::handleMessage); }  }
SqsMessagePoller { @Scheduled(fixedDelay = 1) public void loop() { List<Message> messages = reveiveMessages(); if (messages.isEmpty()) { log.trace("No SQS message received"); return; } log.debug("{} SQS messages are received", messages.size()); messages.stream().parallel().forEach(this::handleMessage); }  @Scheduled(fixedDelay = 1) // SUPPRESS CHECKSTYLE bug? void loop(); }
SqsMessagePoller { @Scheduled(fixedDelay = 1) public void loop() { List<Message> messages = reveiveMessages(); if (messages.isEmpty()) { log.trace("No SQS message received"); return; } log.debug("{} SQS messages are received", messages.size()); messages.stream().parallel().forEach(this::handleMessage); }  @Scheduled(fixedDelay = 1) // SUPPRESS CHECKSTYLE bug? void loop();  }