hellozepp commented on issue #4391: pulsar consumption ack strange behavior
URL: https://github.com/apache/pulsar/issues/4391#issuecomment-501802181
 
 
   @sijie Glad to get your help. I tried to either just ack a partial messages 
and then rerun consumer, or to switch to the `2.3.2` API using the standalone 
mode. The `Java` code did not reproduce this problem.
   
   I consider this problem to be the result of the `scala` library, and I find 
that if I don't call `seek(messageId: MessageId): Unit` or 
`consumer.seekEarliest()` , `consumption,consumer.receive()` will block.
   
   My scala tests are as follows:
   `
     test("producer and consumer message unacknowledged redelivery") {
   
       val client = PulsarClient("pulsar://localhost:6650")
       val topic = Topic("persistent://sample/standalone/ns1/test_" + 
UUID.randomUUID)
   
       val producer = client.producer(ProducerConfig(topic))
       val messageId = producer.send("wibble")
       producer.send("wobble")
       producer.send("wubble")
       producer.close()
   
       var consumer = client.consumer(ConsumerConfig(topics = Seq(topic), 
subscriptionName = Subscription.generate,
         subscriptionType = Some(SubscriptionType.Exclusive)
       ))
       consumer.seek(messageId.get)
       var msg = consumer.receive
       new String(msg.get.data) shouldBe "wibble"
       consumer.acknowledge(msg.get)
       consumer.close()
   
       consumer = client.consumer(ConsumerConfig(topics = Seq(topic), 
subscriptionName = Subscription.generate,
         subscriptionType = Some(SubscriptionType.Exclusive)
       ))
       consumer.seek(messageId.get)
       msg = consumer.receive
       new String(msg.get.data) shouldBe "wibble"
       consumer.close()
       client.close()
     }
   `
   @KannarFr , Is this the right way to do it ?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to