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/06/14 06:08:57 UTC

[GitHub] [pulsar] KIC commented on issue #4501: Pulsar functions should be able to return none and multiple values

KIC commented on issue #4501: Pulsar functions should be able to return none and multiple values
URL: https://github.com/apache/pulsar/issues/4501#issuecomment-501981361
 
 
   @jerrypeng thanks for the clarification, I did not get that returning null is an option :-) 
   
   regarding returning multiple events, I am not saying it is impossible but it is a bit trickier then that:
   
   > This method returns a CompletableFuture. You can always wait for the CompletableFuture to complete before updating the state. If there is a send failure, throw an exception, and in EFFECTIVELY_ONCE, the function instance will restart it self and replay the last message. 
   
   Imagine if you have 10 futures 5 completed 5 failed
   You did not store the state (you would only if all futures completed)
   You throw an exception
   Function restarts (EFFECTIVELY_ONCE)
   
   Now you have the same sate as the one you have had but not stored (function needs to be deterministic). But you have sent 5 of 10 events already, so you need to know that you only have to send messages 6 - 10 plus finally store the state. This could be done by querying the last message/event on the target topic. And this would even hold if only the state store would fail. You throw an exception, in the redo of the function you see 10 of 10 messages were sent, so you just store the state.
   
   However I just think it would be much more user friendly if this is all handled by the function caller and you could optimize accordingly while the project evolves.

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