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 19:26:03 UTC

[GitHub] [pulsar] jerrypeng opened a new issue #4330: Supporting Message output for Java Function

jerrypeng opened a new issue #4330: Supporting Message output for Java Function
URL: https://github.com/apache/pulsar/issues/4330
 
 
   We have discussed and implemented Message as an input for a Java Function: 
   https://github.com/apache/pulsar/pull/4313
   
   Perhaps its time to discuss supporting outputting Message as an option to that users can set any of the fields that is support in the Message interface for an outgoing message
   
   We already have a message builder interface exposed via context, perhaps we can reuse it with some modification to just build a message for outputting instead of having to send it?
   
   Maybe the API can be something like below:
   
   ```
   public class TestFunction implements Function<String, Message<String>> {
   
       @Override
       public Message<String> process(String input, Context context) throws Exception {
   
           FunctionMessageBuilder<String> builder = context.newOutputMessage();
   
           Message message = builder.key("key").value("val").build();
   
           context.publish("topic", Schema.STRING, message);
   
           return message;
       }
   }
   ```
   
   
   @srkukarni @sijie @merlimat @wolfstudy thoughts?

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