Skip to content

Commit

Permalink
check for nil producerspec first (apache#9124)
Browse files Browse the repository at this point in the history
Fixes apache#9123

### Modifications

Check for nil ProducerSpec first

### Verifying this change

as in apache#9123
  • Loading branch information
flowchartsman authored Jan 8, 2021
1 parent 7c09f5c commit 3b6fa26
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pulsar-function-go/pf/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,13 @@ func (gi *goInstance) getProducer(topicName string) (pulsar.Producer, error) {
gi.context.instanceConf.funcDetails.Name), gi.context.instanceConf.instanceID)

batchBuilderType := pulsar.DefaultBatchBuilder
batchBuilder := gi.context.instanceConf.funcDetails.Sink.ProducerSpec.BatchBuilder

if batchBuilder != "" {
if batchBuilder == "KEY_BASED" {
batchBuilderType = pulsar.KeyBasedBatchBuilder
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
}
}
}

Expand Down

0 comments on commit 3b6fa26

Please sign in to comment.