eolivelli commented on issue #12087:
URL: https://github.com/apache/pulsar/issues/12087#issuecomment-927893303


   I am still not sure about this:
   ```
   <T> Message<T> newSingleMessage(int index,
                                       int numMessages,
                                       MessagePayload payload,
                                       boolean containMetadata,
                                       Schema<T> schema);
   ```
   
   problems:
   - we are passing `numMessages` for each message, and so we can pass 
different values. My understanding is that you should use the same value for 
each message in the new batch
   - it is not clear if we can create a new batch that has a different number 
of messages then the original batch
   - why we have to call "newSingleMessage" on `EntryContext` is the 
`EntryContext` a wrapper for the original Message (Entry) on Pulsar ? 
   
   if `EntryContext` is a wrapper for an `Entry` maybe we can call it 
`EntryWrapper`
   if it adds more functionalities to a pure wrapper, can we have two objects ?
   - `EntryWrapper` -> contains methods to access the original Entry and the 
Message in the batch
   - `ConverterContext` -> contains utility methods to build Messages 
   
   ```
   interface ConverterContext {
          <T> BatchBuilder<T> newBatch(int numberOfMessages, Schema<T> schema);
          <T> Message<T> newMessage(MessagePayload payload, Schema<T> schema);
     }
   ```
     
   ```
   interface BatchBuilder<T> {
            Message<T> newMessage(int index, MessagePayload payload....) // not 
sure if we need to pass index, we can compute it automatically probably
            Iterator<Message<T>> buildMessages();
   }
   ```


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