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/09 07:46:26 UTC

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

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



##########
File path: pulsar-function-go/pf/context.go
##########
@@ -153,8 +156,9 @@ func (c *FunctionContext) GetUserConfMap() map[string]interface{} {
 }
 
 // NewOutputMessage send message to the topic @param topicName: The name of the
-// topic for output message
+// topic for output message (DEPRECATED)
 func (c *FunctionContext) NewOutputMessage(topicName string) pulsar.Producer {
+	log.Warn("NewOutputMessage is deprecated, please use Publish() or PublishMsg()")

Review comment:
       We should add a new function like `NewProducer(topicName string) (pulsar.Producer, error)` or with any proper name. the reason is we need to remain this function exists, and let user know with the `log.Warn` if they still want this. 

##########
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:
       @zzzming +1




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