Skip to content
Open
Show file tree
Hide file tree
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 @@ -431,7 +431,7 @@ public CompletableFuture<AckResult> changeInvisibleTime(ProxyContext ctx, Receip
if (StringUtils.isNotBlank(ackResult.getExtraInfo())) {
AckResult result = new AckResult();
result.setStatus(ackResult.getStatus());
result.setPopTime(result.getPopTime());
result.setPopTime(ackResult.getPopTime());
result.setExtraInfo(createHandle(ackResult.getExtraInfo(), commitLogOffset));
return result;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.apache.rocketmq.common.consumer.ReceiptHandle;
import org.apache.rocketmq.common.filter.ExpressionType;
import org.apache.rocketmq.common.message.MessageClientIDSetter;
import org.apache.rocketmq.common.message.MessageConst;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.common.message.MessageQueue;
import org.apache.rocketmq.proxy.common.ProxyContext;
Expand Down Expand Up @@ -301,6 +302,28 @@ public void testChangeInvisibleTime() throws Throwable {
assertEquals(handle.getReceiptHandle(), requestHeaderArgumentCaptor.getValue().getExtraInfo());
}

@Test
public void testChangeInvisibleTimeShouldPreservePopTimeWhenExtraInfoUpdated() throws Throwable {
ReceiptHandle handle = create(createMessageExt(MixAll.RETRY_GROUP_TOPIC_PREFIX + TOPIC, "", 0, 3000));
assertNotNull(handle);

long popTime = 1777203436411L;
String newExtraInfo = "newExtraInfo";
AckResult innerAckResult = new AckResult();
innerAckResult.setStatus(AckStatus.OK);
innerAckResult.setPopTime(popTime);
innerAckResult.setExtraInfo(newExtraInfo);
when(this.messageService.changeInvisibleTime(any(), any(), anyString(), any(), anyLong()))
.thenReturn(CompletableFuture.completedFuture(innerAckResult));

AckResult ackResult = this.consumerProcessor.changeInvisibleTime(createContext(), handle,
MessageClientIDSetter.createUniqID(), CONSUMER_GROUP, TOPIC, 1000, null, 3000, true).get();

assertEquals(AckStatus.OK, ackResult.getStatus());
assertEquals(newExtraInfo + MessageConst.KEY_SEPARATOR + handle.getCommitLogOffset(), ackResult.getExtraInfo());
assertEquals(popTime, ackResult.getPopTime());
}

@Test
public void testLockBatch() throws Throwable {
Set<MessageQueue> mqSet = new HashSet<>();
Expand Down
Loading