You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2021/01/14 02:54:21 UTC
[pulsar] branch branch-2.7 updated: check for nil producerspec
first (#9124)
This is an automated email from the ASF dual-hosted git repository.
penghui pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/branch-2.7 by this push:
new 432b170 check for nil producerspec first (#9124)
432b170 is described below
commit 432b1708a0b9df072c296c6968b7229562889e1a
Author: Andy Walker <wa...@gmail.com>
AuthorDate: Fri Jan 8 03:34:49 2021 -0500
check for nil producerspec first (#9124)
Fixes #9123
Check for nil ProducerSpec first
as in #9123
(cherry picked from commit 3b6fa2629cc28c2860eead3b7f57b391da0956ea)
---
pulsar-function-go/pf/instance.go | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/pulsar-function-go/pf/instance.go b/pulsar-function-go/pf/instance.go
index 949ab5c..029272f 100644
--- a/pulsar-function-go/pf/instance.go
+++ b/pulsar-function-go/pf/instance.go
@@ -221,6 +221,17 @@ func (gi *goInstance) getProducer(topicName string) (pulsar.Producer, error) {
gi.context.instanceConf.funcDetails.Namespace,
gi.context.instanceConf.funcDetails.Name), gi.context.instanceConf.instanceID)
+ batchBuilderType := pulsar.DefaultBatchBuilder
+
+ if gi.context.instanceConf.funcDetails.Sink.ProducerSpec != nil {
+ batchBuilder := gi.context.instanceConf.funcDetails.Sink.ProducerSpec.BatchBuilder
+ if batchBuilder != "" {
+ if batchBuilder == "KEY_BASED" {
+ batchBuilderType = pulsar.KeyBasedBatchBuilder
+ }
+ }
+ }
+
producer, err := gi.client.CreateProducer(pulsar.ProducerOptions{
Topic: topicName,
Properties: properties,