Fix kafka input binding looping when not topics are set (#1412)
* binding kafka: check if topics are not empty before reading Signed-off-by: Tim Burkert <burkert.tim@gmail.com> * binding kafka: log warning instead of returning error Signed-off-by: Tim Burkert <burkert.tim@gmail.com> Co-authored-by: Yaron Schneider <schneider.yaron@live.com> Co-authored-by: Artur Souza <artursouza.ms@outlook.com> Co-authored-by: Dapr Bot <56698301+dapr-bot@users.noreply.github.com>
This commit is contained in:
parent
4631d6e41a
commit
8332b6a9c5
|
@ -226,6 +226,11 @@ func (k *Kafka) getSyncProducer(meta *kafkaMetadata) (sarama.SyncProducer, error
|
|||
}
|
||||
|
||||
func (k *Kafka) Read(handler func(*bindings.ReadResponse) ([]byte, error)) error {
|
||||
if len(k.topics) == 0 {
|
||||
k.logger.Warnf("kafka binding: no topic defined, input bindings will not be started")
|
||||
return nil
|
||||
}
|
||||
|
||||
config := sarama.NewConfig()
|
||||
config.Version = sarama.V1_0_0_0
|
||||
config.Consumer.Offsets.Initial = k.initialOffset
|
||||
|
|
Loading…
Reference in New Issue