Skip to content

Commit cebce8e

Browse files
committed
kafka: document numPartitions in pubsub and bindings metadata
Signed-off-by: akshitguptaa <akshitguptaa29@gmail.com>
1 parent 4e2cb7e commit cebce8e

3 files changed

Lines changed: 29 additions & 1 deletion

File tree

bindings/kafka/metadata.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,20 @@ metadata:
342342
The maximum size in bytes allowed for a single Kafka message.
343343
example: '2048'
344344
default: '1024'
345+
- name: numPartitions
346+
type: number
347+
description: |
348+
If set to a value greater than 0, dapr will create the topic with
349+
this many partitions if it does not already exist. If unset
350+
(default), dapr does not create topics; this is left to the
351+
Kafka broker's own auto-create behavior or external provisioning.
352+
example: '3'
353+
- name: replicationFactor
354+
type: number
355+
description: |
356+
Replication factor used when numPartitions is set and dapr
357+
creates the topic. Defaults to 1.
358+
example: '3'
345359
- name: consumeRetryInterval
346360
type: duration
347361
description: |

common/component/kafka/metadata.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ func (k *Kafka) getKafkaMetadata(meta map[string]string) (*KafkaMetadata, error)
382382
if m.NumPartitions < 0 {
383383
return nil, errors.New("kafka error: 'numPartitions' must be a non-negative number")
384384
}
385-
if m.NumPartitions > 0 && strings.ToLower(m.AuthType) == awsIAMAuthType {
385+
if m.NumPartitions > 0 && strings.EqualFold(m.AuthType, awsIAMAuthType) {
386386
return nil, errors.New("kafka error: 'numPartitions' auto-topic-creation is not supported with authType 'awsiam'")
387387
}
388388
if m.NumPartitions > 0 && m.ReplicationFactor <= 0 {

pubsub/kafka/metadata.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,20 @@ metadata:
303303
The maximum size in bytes allowed for a single Kafka message.
304304
example: '2048'
305305
default: '1024'
306+
- name: numPartitions
307+
type: number
308+
description: |
309+
If set to a value greater than 0, dapr will create the topic with
310+
this many partitions if it does not already exist. If unset
311+
(default), dapr does not create topics; this is left to the
312+
Kafka broker's own auto-create behavior or external provisioning.
313+
example: '3'
314+
- name: replicationFactor
315+
type: number
316+
description: |
317+
Replication factor used when numPartitions is set and dapr
318+
creates the topic. Defaults to 1.
319+
example: '3'
306320
- name: consumeRetryInterval
307321
type: duration
308322
description: |

0 commit comments

Comments
 (0)