dionjansen opened a new issue #61:
URL: https://github.com/apache/pulsar-dotpulsar/issues/61


   Initial issue: https://github.com/apache/pulsar-client-node/issues/129
   
   It seems that sending a single message from either the Python or Node Pulsar 
clients with batching enabled and with message properties cases the dotpulsar 
consumer to read the the properties as part of the message data.
   
   ## Repro
   
   1. Update the `Consuming` example to print the properties:
      ```c#
      var props = string.Join(", ", message.Properties.Select(p => 
$"{p.Key}={p.Value}"));
      Console.WriteLine($"Received: '{data}', props: {props}");
      ```
   1. Producer a message using either the Python or node pulsar clients with 
batching enabled. In all tests performed the message body is `test` and the 
message properties are `{"client": "python"}` or `{"client": "node"}` depending 
on the producing client e.g. for node:
   
      ```ts
      const producer = await client.createProducer({
        topic: 'persistent://public/default/test',
        batchingEnabled: true
      });
    
      await producer.send({
        data: Buffer.from("test"),
        properties: {
          client: "node",
        },
      });
      ```
   ## Expected
   
   The `Consuming` example should print:
   
   ```bash
   Press a key to exit
   The consumer for topic 'persistent://test/topic' is active
   Received: 'test', props: client=python
   Received: 'test', props: client=node
   ```
   
   ## Actual
   
   The `Consuming` example prints:
   
   ```bash
   Press a key to exit
   The consumer for topic 'persistent://test/topic' is active
   Received: '
   
   clientpythontest', props: 
   Received: '
   
   clientnodetest', props: 
   ```
   
   ## Extra info
   
   1. Misreading the message body/ properties only occurs when batching is 
*enabled* on the producer
   1. The issue *does not* occurs when batching is *enabled* on the producer 
but the batch contains more than 1 message
   1. I have not tested other clients
   1. I have tested consuming using the Java client and this works as expected
   1. The Node and Python clients are both based on the 
[cpp-client](https://github.com/apache/pulsar/tree/master/pulsar-client-cpp)
   1. Below are some more details presented for both the working as the not 
working cases for both Node and Python:
   
   In the results below I recorded the raw frames retrieved by the dotpulsar 
client:
   
   * Batching: disabled
     * Message: "test"
     * Properties: `{"client": "python"}`
       * Frame: `System.Buffers.ReadOnlySequence<Byte>[84] 
0,0,0,24,8,9,74,20,8,0,18,16,8,184,84,16,2,24,255,255,255,255,255,255,255,255,255,1,14,1,22,119,98,99,0,0,0,42,10,13,112,117,108,115,97,114,45,54,50,45,49,54,48,16,0,24,222,185,230,190,209,46,34,16,10,6,99,108,105,101,110,116,18,6,112,121,116,104,111,110,116,101,115,116`
       * Metadata: `MetadataSize 42 NumMessagesInBatch 1 
metadata.Properties.Count: 1`
     * Properties: `{"client": "node"}`
       * Frame `System.Buffers.ReadOnlySequence<Byte>[82] 
0,0,0,24,8,9,74,20,8,0,18,16,8,184,84,16,3,24,255,255,255,255,255,255,255,255,255,1,14,1,156,178,222,175,0,0,0,40,10,13,112,117,108,115,97,114,45,54,50,45,49,54,49,16,0,24,132,214,231,190,209,46,34,14,10,6,99,108,105,101,110,116,18,4,110,111,100,101,116,101,115,116`
       * `MetadataSize 40 NumMessagesInBatch 1 metadata.Properties.Count: 1`
   * Batching: enabled:
     * Message: "test"
     * Properties: `{"client": "python"}`
       * Frame: `System.Buffers.ReadOnlySequence<Byte>[92] 
0,0,0,24,8,9,74,20,8,0,18,16,8,184,84,16,4,24,255,255,255,255,255,255,255,255,255,1,14,1,99,1,207,89,0,0,0,26,10,13,112,117,108,115,97,114,45,54,50,45,49,54,50,16,0,24,251,144,235,190,209,46,88,1,0,0,0,20,10,16,10,6,99,108,105,101,110,116,18,6,112,121,116,104,111,110,24,4,116,101,115,116`
       * MetdaData: `MetadataSize 26 NumMessagesInBatch 1 
metadata.Properties.Count: 0`
     * Properties: `{"client": "node"}`
       * Frame: `System.Buffers.ReadOnlySequence<Byte>[90] 
0,0,0,24,8,9,74,20,8,0,18,16,8,184,84,16,5,24,255,255,255,255,255,255,255,255,255,1,14,1,59,201,107,43,0,0,0,26,10,13,112,117,108,115,97,114,45,54,50,45,49,54,51,16,0,24,148,247,235,190,209,46,88,1,0,0,0,18,10,14,10,6,99,108,105,101,110,116,18,4,110,111,100,101,24,4,116,101,115,116`
       * `MetadataSize 26 NumMessagesInBatch 1 metadata.Properties.Count: 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:
us...@infra.apache.org


Reply via email to