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 2019/05/21 23:21:42 UTC

[GitHub] [pulsar] jerrypeng edited a comment on issue #4313: Support Pulsar Message as function input

jerrypeng edited a comment on issue #4313:  Support Pulsar Message as function input
URL: https://github.com/apache/pulsar/pull/4313#issuecomment-494593842
 
 
   Alternatively, instead of allowing user's to be able to have Message<T> as input to a function, a simpler approach of we would be just to add this API to Context:
   
   ```
    Message getInternalMessage();
   ```
   
   and the Impl would be:
   
   ```
   Message getInternalMessage() {
   return ((PulsarRecord) this.record).getMessage);
   }
   ```
   
   There also isn't any good way (without breaking BC) for the WindowFunction API to support Message as a input since the WindowFunction API is 
   
   ```
   public interface WindowFunction<I, O> {
       /**
        * Process the input.
        *
        * @return the output
        */
       O process(Collection<Record<I>> input, WindowContext context) throws Exception;
   }
   ```
   
   I don't think it makes much sense to do 
   
   ```
       O process(Collection<Record<Message<I>>> input, WindowContext context) throws Exception;
   
   ```
   
   Perhaps we can change the API for WindowFunction to be something like
   
   ```
       O process(Window<I> input, WindowContext context) throws Exception;
   ```
   and you can do 
   ```
   input.getAsMessage()
   ```
   
   or in the WindowContext we implement a method like
   
   ```
   context.getWindowAsMessages()
   ```
   
   
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services