Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ public void testNegativeAcksWithBackoff(boolean batching, boolean usePartitions,
Producer<String> producer = pulsarClient.newProducer(Schema.STRING)
.topic(topic)
.enableBatching(batching)
.batchingMaxPublishDelay(30, TimeUnit.SECONDS)
.create();

Set<String> sentMessages = new HashSet<>();
Expand All @@ -258,8 +259,9 @@ public void testNegativeAcksWithBackoff(boolean batching, boolean usePartitions,
for (int i = 0; i < redeliverCount; i++) {
Message<String> msg = null;
for (int j = 0; j < N; j++) {
msg = consumer.receive();
log.info("Received message {}", msg.getValue());
msg = consumer.receive(10, TimeUnit.SECONDS);
assertNotNull(msg);
log.info("Received msgId: {}, message {}", msg.getMessageId(), msg.getValue());
if (!batching) {
consumer.negativeAcknowledge(msg);
}
Expand All @@ -275,7 +277,8 @@ public void testNegativeAcksWithBackoff(boolean batching, boolean usePartitions,

// All the messages should be received again
for (int i = 0; i < N; i++) {
Message<String> msg = consumer.receive();
Message<String> msg = consumer.receive(10, TimeUnit.SECONDS);
assertNotNull(msg);
receivedMessages.add(msg.getValue());
consumer.acknowledge(msg);
}
Expand Down
Loading