Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #242 from jcockrill-rq/fix-AMQPObservableQueue-ack…
Browse files Browse the repository at this point in the history
…-behaviour

Issue#241 fix AMQPObservableQueue behaviour to return failed message…
  • Loading branch information
v1r3n committed Sep 2, 2023
2 parents c67c136 + 5a3792e commit 941f072
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,16 @@ public Address[] getAddresses() {
}

public List<String> ack(List<Message> messages) {
final List<String> processedDeliveryTags = new ArrayList<>();
final List<String> failedMessages = new ArrayList<>();
for (final Message message : messages) {
try {
ackMsg(message);
processedDeliveryTags.add(message.getReceipt());
} catch (final Exception e) {
LOGGER.error("Cannot ACK message with delivery tag {}", message.getReceipt(), e);
failedMessages.add(message.getReceipt());
}
}
return processedDeliveryTags;
return failedMessages;
}

public void ackMsg(Message message) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,9 @@ public void testAck() throws IOException, TimeoutException {
msg.setPayload("Payload");
msg.setReceipt("1");
messages.add(msg);
List<String> deliveredTags = observableQueue.ack(messages);
assertNotNull(deliveredTags);
List<String> failedMessages = observableQueue.ack(messages);
assertNotNull(failedMessages);
assertTrue(failedMessages.isEmpty());
}

private void testGetMessagesFromExchangeAndDefaultConfiguration(
Expand Down

0 comments on commit 941f072

Please sign in to comment.