You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/04/29 01:06:44 UTC
[GitHub] [pulsar] congbobo184 opened a new issue #10431: [Transaction bug] Transaction cumulativeAck bug.
congbobo184 opened a new issue #10431:
URL: https://github.com/apache/pulsar/issues/10431
example:
Transaction abort message1, message2 and then clear incomingMessages.
after incomingMessage cleared the message3 can add in incomingMessages. This time we cumulativeAck message3 with txn will lose message1 and message2.
```
@Test
public void transactionCumulativeAck() throws Exception {
String topic = NAMESPACE1 + "/txn-timeout";
@Cleanup
Consumer<String> consumer = pulsarClient.newConsumer(Schema.STRING)
.topic(topic)
.subscriptionName("test")
.subscribe();
@Cleanup
Producer<String> producer = pulsarClient.newProducer(Schema.STRING)
.topic(topic)
.sendTimeout(0, TimeUnit.SECONDS)
.enableBatching(false)
.producerName("txn-timeout")
.create();
producer.send("Hello Pulsar one!");
producer.send("Hello Pulsar two!");
Transaction transaction = pulsarClient
.newTransaction()
.withTransactionTimeout(3, TimeUnit.SECONDS)
.build().get();
Message<String> message = consumer.receive();
System.out.println(message.getValue());
consumer.acknowledgeCumulativeAsync(message.getMessageId(), transaction).get();
transaction.abort();
transaction = pulsarClient
.newTransaction()
.withTransactionTimeout(3, TimeUnit.SECONDS)
.build().get();
// it may receive Hello Pulsar two!
Message<String> reReceiveMessage = consumer.receive(2, TimeUnit.SECONDS);
System.out.println(reReceiveMessage.getValue());
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] codelipenghui commented on issue #10431: [Messaging] Cumulative ack may lose message.
Posted by GitBox <gi...@apache.org>.
codelipenghui commented on issue #10431:
URL: https://github.com/apache/pulsar/issues/10431#issuecomment-1058890878
The issue had no activity for 30 days, mark with Stale label.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org