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 2021/02/08 21:28:30 UTC

[GitHub] [pulsar] zzzming commented on a change in pull request #9515: Initial checkin of PublishMessage/Publish

zzzming commented on a change in pull request #9515:
URL: https://github.com/apache/pulsar/pull/9515#discussion_r572385903



##########
File path: pulsar-function-go/pf/context.go
##########
@@ -25,18 +25,21 @@ import (
 	"time"
 
 	"github.com/apache/pulsar-client-go/pulsar"
+	log "github.com/apache/pulsar/pulsar-function-go/logutil"
 )
 
 // FunctionContext provides contextual information to the executing function.
 // Features like which message id we are handling, whats the topic name of the
 // message, what are our operating constraints, etc can be accessed by the
 // executing function
 type FunctionContext struct {
-	instanceConf  *instanceConf
-	userConfigs   map[string]interface{}
-	logAppender   *LogAppender
-	outputMessage func(topic string) pulsar.Producer
-	record        pulsar.Message
+	instanceConf   *instanceConf
+	userConfigs    map[string]interface{}
+	logAppender    *LogAppender
+	outputMessage  func(topic string) pulsar.Producer
+	Publish        func(topic string, payload []byte)
+	PublishMessage func(topic string, message pulsar.ProducerMessage)

Review comment:
       Can you give little more control to the caller with a context and return an error? 
   1. Something like func(ctx Context, topic string, payload []byte), since you are creating and passing a context to the lower level anyway.
   2. Return an error instead of log.Fatal crash the process. 




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