check for nil producerspec first
Fixes
### Modifications
Check for nil ProducerSpec first
### Verifying this change
as in
@@ -222,13 +222,15 @@ 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 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,
