gkimes opened a new issue, #16555:
URL: https://github.com/apache/pulsar/issues/16555

   Python pulsar-client package
   
   **Describe the bug**
   Attempting to provide the function `PulsarClient::create_reader()` with the 
param `start_message_id` as an instance of `pulsar.MessageId` raises an error. 
It only accepts a `_pulsar.MessageId`, which is the [internal implementation of 
MessageId](https://github.com/apache/pulsar/blob/master/pulsar-client-cpp/python/pulsar/__init__.py#L123).
 
   
   **To Reproduce**
   
   ```python
       import pulsar 
       
       pulsar_client = pulsar.Client(
           PULSAR_URL,
           authentication=pulsar.AuthenticationToken(PULSAR_TOKEN),
       )
       message_id = pulsar.MessageId(ledger_id=LEDGER_ID, entry_id=ENTRY_ID)
       pulsar_client.create_reader(TOPIC, message_id)
   ```
   
   ```
   Traceback (most recent call last):
       ... # my code
       pulsar_client.create_reader(TOPIC, message_id)
     File 
"/opt/conda/envs/base/lib/python3.8/site-packages/pulsar/__init__.py", line 
825, in create_reader
       _check_type(_pulsar.MessageId, start_message_id, 'start_message_id')
     File 
"/opt/conda/envs/base/lib/python3.8/site-packages/pulsar/__init__.py", line 
1338, in _check_type
       raise ValueError("Argument %s is expected to be of type '%s' and not 
'%s'"
   ValueError: Argument start_message_id is expected to be of type 'MessageId' 
and not 'MessageId'
   ```
   
   **Expected behavior**
   Should allow a `pulsar.MessageId` instance to be provided. Current 
workaround is to either access the private property `message_id._msg_id`, or 
serialize & deserialize to get a _pulsar.MessageId instance. 
   
   [Here is the line that performs the instance check and throws the 
error.](https://github.com/apache/pulsar/blob/master/pulsar-client-cpp/python/pulsar/__init__.py#L834)
   
   **Versions**
   - pulsar-client==2.10.0
   - Python 3.8.13
   
   


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

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to