tobgu opened a new issue #3180: Go client Reader panics when passing custom 
StartMessageID 
URL: https://github.com/apache/pulsar/issues/3180
 
 
   #### Expected behavior
   
   I can pass arbitrary type implementing the `pulsar.MessageID` interface in 
`pulsar.ReaderOptions`when creating a Reader instance.
   
   #### Actual behavior
   
   When I pass a custom type the client library panics:
   ````
   panic: interface conversion: pulsar.MessageID is mypackage.pulsarMessageID, 
not *pulsar.messageID
        /usr/local/go/src/runtime/panic.go:513 +0x1b9
   
github.com/apache/pulsar/pulsar-client-go/pulsar.createReaderAsync(0xc0002229a0,
 0xc0001fe29a, 0x9, 0x0, 0x0, 0xb800a0, 0xc0002fb6e0, 0xc00018dd40, 0x0, 0x0, 
...)
        
/go/pkg/mod/github.com/apache/pulsar@v2.2.0+incompatible/pulsar-client-go/pulsar/c_reader.go:115
 +0x504
   
github.com/apache/pulsar/pulsar-client-go/pulsar.(*client).CreateReaderAsync(0xc0002229a0,
 0xc0001fe29a, 0x9, 0x0, 0x0, 0xb800a0, 0xc0002fb6e0, 0x0, 0x0, 0x0, ...)
        
/go/pkg/mod/github.com/apache/pulsar@v2.2.0+incompatible/pulsar-client-go/pulsar/c_client.go:220
 +0x65
   
github.com/apache/pulsar/pulsar-client-go/pulsar.(*client).CreateReader(0xc0002229a0,
 0xc0001fe29a, 0x9, 0x0, 0x0, 0xb800a0, 0xc0002fb6e0, 0x0, 0x0, 0x0, ...)
        
/go/pkg/mod/github.com/apache/pulsar@v2.2.0+incompatible/pulsar-client-go/pulsar/c_client.go:207
 +0xca
   ````
   
   The culprit is the following line:
   ```go
   // Unchecked type assertion assuming that StartMessageID is of type 
*messageID
   C._pulsar_client_create_reader_async(client.ptr, topic, 
options.StartMessageID.(*messageID).ptr,
        conf, savePointer(&readerAndCallback{reader, conf, callback}))
   ```
   
   #### Steps to reproduce
   See above
   
   #### System configuration
   **Pulsar version**: 2.2
   github.com/apache/pulsar v2.2.0+incompatible 
h1:i2dfg67DNdHRgdzdIiSObTb9VRavAtZStxC4YIySxAI=
   github.com/apache/pulsar v2.2.0+incompatible/go.mod 
h1:7npmYEEu+jEeIMdpGSJwrTxUB86OW/UM5IkJCAyfl5Y=
   g
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to