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/11/10 17:44:22 UTC

[GitHub] [pulsar] AlNedorezov opened a new issue #12733: peek message for pulsar-admin java client does not return a key of peeked message

AlNedorezov opened a new issue #12733:
URL: https://github.com/apache/pulsar/issues/12733


   **Describe the bug**
   For messages got via pulsarAdmin.topics().peekMessages(topic, subscription, total) method from pulsar-client-admin, getKey() method always returns an empty string.
   
   **To Reproduce**
   Steps to reproduce the behavior:
   1. Write some messages with specified message keys to a topic
   2. Call pulsarAdmin.topics().peekMessages(topic, subscription, total); (pulsarAdmin is an instance of org.apache.pulsar.client.admin.PulsarAdmin)
   3. For a message from a list of message received on previous step call getKey() method
   4. empty string will be returned 
   
   **Expected behavior**
   getKey() method should return a message key.
   
   **Screenshots**
   E.g. of getKey() result for a peeked message:
   ![image](https://user-images.githubusercontent.com/2508992/141163650-4758e278-e441-413c-b114-adc7e3b51243.png)
   
   E.g. of getKey() result for the same message which was received:
   ![image](https://user-images.githubusercontent.com/2508992/141163809-4335e64c-f1d3-4b24-820a-b080c19501aa.png)
   
   **Desktop (please complete the following information):**
   we are using pulsar-client-admin v2.7.2
   ```
           <dependency>
               <groupId>org.apache.pulsar</groupId>
               <artifactId>pulsar-client-admin</artifactId>
               <version>2.7.2</version>
           </dependency>
   ```
   
   **Additional context**
   
   A bit of a shot in the dark, but I think this happens because for peeked message getKey() returns a partiton key from metadata, but not the actual key itself.
   
   See org.apache.pulsar.client.impl.MessageImpl:
   ![image](https://user-images.githubusercontent.com/2508992/141164735-466284f8-f3ae-4c0a-85d3-0aadf6ea8ed6.png)
   
   AFAIK pulsar-admin java client uses pulsar-admin rest api, and API doesn't actually return a key, only metadata.getPartitionKey().
   See https://github.com/apache/pulsar/blob/a2b7cae3cfe8d3776483b1ecaf69af47949b70e1/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java#L2595


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



[GitHub] [pulsar] AlNedorezov edited a comment on issue #12733: peek message for pulsar-admin java client does not return a key of a peeked message

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


   @codelipenghui yes, subscription was there before any messages were written. Not sure how is this relevant though. PeekMessages returns a list of messages as expected, it's just that they do not contain keys that is the issue.
   
   @gaozhangmin thanks for the information. I will check it in the newer version


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



[GitHub] [pulsar] github-actions[bot] commented on issue #12733: peek message for pulsar-admin java client does not return a key of a peeked message

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #12733:
URL: https://github.com/apache/pulsar/issues/12733#issuecomment-1052937425


   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



[GitHub] [pulsar] gaozhangmin commented on issue #12733: peek message for pulsar-admin java client does not return a key of a peeked message

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


   This issue resolved in master branch.


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



[GitHub] [pulsar] codelipenghui commented on issue #12733: peek message for pulsar-admin java client does not return a key of a peeked message

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


   @AlNedorezov Have you created the subscription before writing some messages? You can check the topic internal stats to see if the subscription is reach the end of the topic.


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



[GitHub] [pulsar] eolivelli commented on issue #12733: peek message for pulsar-admin java client does not return a key of a peeked message

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


   @gaozhangmin can you please point to the PR which fixed 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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] AlNedorezov commented on issue #12733: peek message for pulsar-admin java client does not return a key of a peeked message

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


   @codelipenghui yes, subscription was there before any messages were written. Not sure how is this relevant though.
   
   @gaozhangmin thanks for the information. I will check it in the newer version


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



[GitHub] [pulsar] aloyszhang commented on issue #12733: peek message for pulsar-admin java client does not return a key of a peeked message

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


   @AlNedorezov @eolivelli  you can see this pull request https://github.com/apache/pulsar/pull/11443


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