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/02/01 01:07:16 UTC

[GitHub] [pulsar] maimom1924 opened a new issue #9330: Pulsar reader doesn't return correct last message with startMessageIdInclusive()

maimom1924 opened a new issue #9330:
URL: https://github.com/apache/pulsar/issues/9330


   I want to read last message from topic "A"  by using Pulsar Reader as shown in below code:
   
   ```
   Reader<byte[]> reader= pulsarClient.newReader()
                       .topic("A")
                       .startMessageIdInclusive()
                       .startMessageId(MessageId.latest)
                       .create();
   if(reader.hasMessageAvailable()) {
       Message<byte[]> msg= reader.readNext();
   }
   ```
   Before executing the above code, I have produced many messages on that topic and as the result:
   - The `msg` that I get here is not the last message but `the last message - 1` when I add ` .startMessageIdInclusive()`
   - Without adding ` .startMessageIdInclusive()`, `reader.hasMessageAvailable()` will return false. 
   
   
   Pulsar version that I used:
   - Version of pulsar jar: 2.5.0
   -  Version of pulsar for run my pulsar instance: 2.7.0
   


----------------------------------------------------------------
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] zymap commented on issue #9330: Pulsar reader doesn't return correct last message with startMessageIdInclusive()

Posted by GitBox <gi...@apache.org>.
zymap commented on issue #9330:
URL: https://github.com/apache/pulsar/issues/9330#issuecomment-771343900


   Sorry for my misunderstanding. Yes, if the topic is empty, it should return false. 
   
   I found there has some PRs are fixing this issue: #9316 and #8735 


----------------------------------------------------------------
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] zymap commented on issue #9330: Pulsar reader doesn't return correct last message with startMessageIdInclusive()

Posted by GitBox <gi...@apache.org>.
zymap commented on issue #9330:
URL: https://github.com/apache/pulsar/issues/9330#issuecomment-770495992


   @maimom1924 I think it's the right behavior because you specified the `startMessageIdInclusive` which means you can read out the last message.


----------------------------------------------------------------
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 closed issue #9330: Pulsar reader doesn't return correct last message with startMessageIdInclusive()

Posted by GitBox <gi...@apache.org>.
codelipenghui closed issue #9330:
URL: https://github.com/apache/pulsar/issues/9330


   


----------------------------------------------------------------
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] maimom1924 commented on issue #9330: Pulsar reader doesn't return correct last message with startMessageIdInclusive()

Posted by GitBox <gi...@apache.org>.
maimom1924 commented on issue #9330:
URL: https://github.com/apache/pulsar/issues/9330#issuecomment-770511926


   so even though there is no message, that should return true, right?
   
   On Mon, Feb 1, 2021, 10:09 AM Yong Zhang <no...@github.com> wrote:
   
   > @maimom1924 <https://github.com/maimom1924> I think it's the right
   > behavior because you specified the startMessageIdInclusive which means
   > you can read out the last message.
   >
   > —
   > You are receiving this because you were mentioned.
   > Reply to this email directly, view it on GitHub
   > <https://github.com/apache/pulsar/issues/9330#issuecomment-770495992>, or
   > unsubscribe
   > <https://github.com/notifications/unsubscribe-auth/ASTNJLPKDQB4ZMVGVBZLO4LS4X5M5ANCNFSM4WT4NA2A>
   > .
   >
   


----------------------------------------------------------------
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] zymap commented on issue #9330: Pulsar reader doesn't return correct last message with startMessageIdInclusive()

Posted by GitBox <gi...@apache.org>.
zymap commented on issue #9330:
URL: https://github.com/apache/pulsar/issues/9330#issuecomment-770690257


   Yes. After reading the last message, then the `reader. hasMessageAvailable` will return false.


----------------------------------------------------------------
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] adrianog commented on issue #9330: Pulsar reader doesn't return correct last message with startMessageIdInclusive()

Posted by GitBox <gi...@apache.org>.
adrianog commented on issue #9330:
URL: https://github.com/apache/pulsar/issues/9330#issuecomment-822047081


   How do you use this in python? I see no provision for 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:
users@infra.apache.org



[GitHub] [pulsar] zymap commented on issue #9330: Pulsar reader doesn't return correct last message with startMessageIdInclusive()

Posted by GitBox <gi...@apache.org>.
zymap commented on issue #9330:
URL: https://github.com/apache/pulsar/issues/9330#issuecomment-768846451


   @maimom1924 Looks like this issue already addressed by this PR https://github.com/apache/pulsar/pull/6362. You can try with 2.5.1 or higher version to test 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:
users@infra.apache.org



[GitHub] [pulsar] zymap commented on issue #9330: Pulsar reader doesn't return correct last message with startMessageIdInclusive()

Posted by GitBox <gi...@apache.org>.
zymap commented on issue #9330:
URL: https://github.com/apache/pulsar/issues/9330#issuecomment-771335429


   @maimom1924 
   
   ```
           PulsarAdmin admin = PulsarAdmin.builder()
               .serviceHttpUrl("http://localhost:8080")
               .build();
           admin.topics().createNonPartitionedTopic("test");
   
           PulsarClient client = PulsarClient.builder()
               .serviceUrl("pulsar://localhost:6650")
               .build();
   
           Reader reader = client.newReader()
               .topic("test")
               .startMessageId(MessageId.latest)
               .startMessageIdInclusive()
               .create();
   
           // there hasn't message available
           System.out.println(reader.hasMessageAvailable());
   ```
   
   I create a empty topic and it returns false.


----------------------------------------------------------------
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 closed issue #9330: Pulsar reader doesn't return correct last message with startMessageIdInclusive()

Posted by GitBox <gi...@apache.org>.
codelipenghui closed issue #9330:
URL: https://github.com/apache/pulsar/issues/9330


   


----------------------------------------------------------------
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] maimom1924 commented on issue #9330: Pulsar reader doesn't return correct last message with startMessageIdInclusive()

Posted by GitBox <gi...@apache.org>.
maimom1924 commented on issue #9330:
URL: https://github.com/apache/pulsar/issues/9330#issuecomment-771273626


   @zymap I mean that the topic is completely empty, so the `reader. hasMessageAvailable` should return false, right? but I got true value.


----------------------------------------------------------------
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] zymap removed a comment on issue #9330: Pulsar reader doesn't return correct last message with startMessageIdInclusive()

Posted by GitBox <gi...@apache.org>.
zymap removed a comment on issue #9330:
URL: https://github.com/apache/pulsar/issues/9330#issuecomment-771335429


   @maimom1924 
   
   ```
           PulsarAdmin admin = PulsarAdmin.builder()
               .serviceHttpUrl("http://localhost:8080")
               .build();
           admin.topics().createNonPartitionedTopic("test");
   
           PulsarClient client = PulsarClient.builder()
               .serviceUrl("pulsar://localhost:6650")
               .build();
   
           Reader reader = client.newReader()
               .topic("test")
               .startMessageId(MessageId.latest)
               .startMessageIdInclusive()
               .create();
   
           // there hasn't message available
           System.out.println(reader.hasMessageAvailable());
   ```
   
   I create a empty topic and it returns false.


----------------------------------------------------------------
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] zymap commented on issue #9330: Pulsar reader doesn't return correct last message with startMessageIdInclusive()

Posted by GitBox <gi...@apache.org>.
zymap commented on issue #9330:
URL: https://github.com/apache/pulsar/issues/9330#issuecomment-771335429






----------------------------------------------------------------
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] maimom1924 commented on issue #9330: Pulsar reader doesn't return correct last message with startMessageIdInclusive()

Posted by GitBox <gi...@apache.org>.
maimom1924 commented on issue #9330:
URL: https://github.com/apache/pulsar/issues/9330#issuecomment-771273626


   @zymap I mean that the topic is completely empty, so the `reader. hasMessageAvailable` should return false, right? but I got true value.


----------------------------------------------------------------
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] zymap removed a comment on issue #9330: Pulsar reader doesn't return correct last message with startMessageIdInclusive()

Posted by GitBox <gi...@apache.org>.
zymap removed a comment on issue #9330:
URL: https://github.com/apache/pulsar/issues/9330#issuecomment-771335429


   @maimom1924 
   
   ```
           PulsarAdmin admin = PulsarAdmin.builder()
               .serviceHttpUrl("http://localhost:8080")
               .build();
           admin.topics().createNonPartitionedTopic("test");
   
           PulsarClient client = PulsarClient.builder()
               .serviceUrl("pulsar://localhost:6650")
               .build();
   
           Reader reader = client.newReader()
               .topic("test")
               .startMessageId(MessageId.latest)
               .startMessageIdInclusive()
               .create();
   
           // there hasn't message available
           System.out.println(reader.hasMessageAvailable());
   ```
   
   I create a empty topic and it returns false.


----------------------------------------------------------------
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] adrianog edited a comment on issue #9330: Pulsar reader doesn't return correct last message with startMessageIdInclusive()

Posted by GitBox <gi...@apache.org>.
adrianog edited a comment on issue #9330:
URL: https://github.com/apache/pulsar/issues/9330#issuecomment-822047081


   How do you use this in python? I see no provision at all for startMessageIdInclusive .


-- 
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] maimom1924 edited a comment on issue #9330: Pulsar reader doesn't return correct last message with startMessageIdInclusive()

Posted by GitBox <gi...@apache.org>.
maimom1924 edited a comment on issue #9330:
URL: https://github.com/apache/pulsar/issues/9330#issuecomment-770381508


   Thank you so much for your help and support. I tried to test with version
   2.5.1 but when there is no message on the topic and I call the
   reader.hasMessageAvailable(),  I got true value. Could you please help
   check on this?
   
   Reader<byte[]> reader = pulsarClient.newReader()
           .topic(config.getStateTopic())
           .startMessageId(MessageId.latest)
           .startMessageIdInclusive()
           .create();
   boolean hasMessage = reader.hasMessageAvailable();
   


----------------------------------------------------------------
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 #9330: Pulsar reader doesn't return correct last message with startMessageIdInclusive()

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on issue #9330:
URL: https://github.com/apache/pulsar/issues/9330#issuecomment-770223875


   @maimom1924 @zymap I will close this issue first, feel free to reopen it if needed.


----------------------------------------------------------------
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] maimom1924 commented on issue #9330: Pulsar reader doesn't return correct last message with startMessageIdInclusive()

Posted by GitBox <gi...@apache.org>.
maimom1924 commented on issue #9330:
URL: https://github.com/apache/pulsar/issues/9330#issuecomment-770381508


   Dear sir/madam,
   
   Thank you so much for your help and support. I tried to test with version
   2.5.1 but when there is no message on the topic and I call the
   reader.hasMessageAvailable(),  I got true value. Could you please help
   check on this?
   
   Regards,
   Mai Mom
   
   Reader<byte[]> reader = pulsarClient.newReader()
           .topic(config.getStateTopic())
           .startMessageId(MessageId.latest)
           .startMessageIdInclusive()
           .create();
   boolean hasMessage = reader.hasMessageAvailable();
   
   
   On Sat, Jan 30, 2021 at 11:54 PM lipenghui <no...@github.com> wrote:
   
   > Closed #9330 <https://github.com/apache/pulsar/issues/9330>.
   >
   > —
   > You are receiving this because you were mentioned.
   > Reply to this email directly, view it on GitHub
   > <https://github.com/apache/pulsar/issues/9330#event-4269208002>, or
   > unsubscribe
   > <https://github.com/notifications/unsubscribe-auth/ASTNJLOEGTY7JAP2HBQEQ23S4QMTHANCNFSM4WT4NA2A>
   > .
   >
   


----------------------------------------------------------------
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