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 19:58:29 UTC

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

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



##########
File path: pulsar-function-go/pf/instance.go
##########
@@ -75,6 +75,29 @@ func newGoInstance() *goInstance {
 		return producer
 	}
 
+	contextPublish := func(topic string, message pulsar.ProducerMessage) {
+		producer, err := goInstance.getProducer(topic)
+		if err != nil {
+			log.Fatal(err)
+		}
+		ctx := context.Background()
+		producer.SendAsync(ctx, &message, func(_ pulsar.MessageID, _ *pulsar.ProducerMessage, err error) {
+			if err != nil {
+				goInstance.stats.incrTotalSysExceptions(err)
+				log.Fatal(err)

Review comment:
       Do we want to exit the process here or instead return an error to allow users to handle delivering failures?

##########
File path: pulsar-function-go/examples/publishFunc/publishFunc.go
##########
@@ -36,19 +36,13 @@ func PublishFunc(ctx context.Context, in []byte) error {
 
 	publishTopic := "publish-topic"
 	output := append(in, 110)
-
-	producer := fctx.NewOutputMessage(publishTopic)
-	msgID, err := producer.Send(ctx, &pulsar.ProducerMessage{
+	log.Printf("publishing to additional topic %s", publishTopic)

Review comment:
       is this for debugging purpose and will be removed when checked in?




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