@Test public void test_1ExcessiveHeavyMessage() throws Exception { sut.setVisibilityTimeout(60); sut.setChangeVisibilityThreshold(1); Message msg1 = createMessage(1); DeleteMessageRequest expectedDmr = createDeleteMessageRequest(1); when(sqs.receiveMessage(any(ReceiveMessageRequest.class))).thenReturn(receiveMessageResultOf(msg1)); doAnswer(createHeavyJobAnswer(24, false)).when(messageHandler).accept(any(Message.class)); sut.loop(); verify(sqs).receiveMessage(any(ReceiveMessageRequest.class)); verify(messageHandler).accept(eq(msg1)); verify(sqs, never()).deleteMessage(eq(expectedDmr)); verify(sqs, times(3)).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();  }