srkukarni commented on a change in pull request #3854: [issue #3767] support go
function for pulsar
URL: https://github.com/apache/pulsar/pull/3854#discussion_r272272126
##########
File path: pulsar-function-go/pf/instance.go
##########
@@ -195,26 +199,26 @@ func (gi *GoInstance) setupConsumer() (chan
pulsar.ConsumerMessage, error) {
return nil, err
}
gi.consumers[topic] = consumer
- gi.context.InputTopics = append(gi.context.InputTopics, topic)
+ gi.context.inputTopics = append(gi.context.inputTopics, topic)
}
return channel, nil
}
-func (gi *GoInstance) handlerMsg(input pulsar.Message) (output []byte, err
error) {
+func (gi *goInstance) handlerMsg(input pulsar.Message) (output []byte, err
error) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ctx = NewContext(ctx, gi.context)
msgInput := input.Payload()
- return gi.function.Process(ctx, msgInput)
+ return gi.function.process(ctx, msgInput)
}
-func (gi *GoInstance) processResult(msgInput pulsar.Message, output []byte) {
- atLeastOnce := gi.context.InstanceConf.FuncDetails.ProcessingGuarantees
== pb.ProcessingGuarantees_ATLEAST_ONCE
- atMostOnce := gi.context.InstanceConf.FuncDetails.ProcessingGuarantees
== pb.ProcessingGuarantees_ATMOST_ONCE
- effectivelyOnce :=
gi.context.InstanceConf.FuncDetails.ProcessingGuarantees ==
pb.ProcessingGuarantees_EFFECTIVELY_ONCE
- autoAck := gi.context.InstanceConf.FuncDetails.AutoAck
+func (gi *goInstance) processResult(msgInput pulsar.Message, output []byte) {
+ atLeastOnce := gi.context.instanceConf.funcDetails.ProcessingGuarantees
== pb.ProcessingGuarantees_ATLEAST_ONCE
Review comment:
one nit, these vars dont change at all. Maybe hold them as member variables?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services