0

I have a spring-cloud-stream-kafka project. The following is an abbreviated section of application.yaml. I am interested in injecting the value for the property spring.cloud.stream.kafka.bindings.myNamedChannel.dlqPartitions into code:

spring:
  cloud:
    stream:        
      kafka:
        bindings:
          myNamedChannel-in-0:
            consumer:
              start-offset: earliest
              enable-dlq: true
              dlq-partitions: 4
              dlq-name: myNamedChannel-dlt

I have tried permutations on the following without any success. Is something like this possible?

@Value("${spring.cloud.stream.kafka.bindings.myNamedChannel.consumer.dlqPartitions}")
private int CONTEXT_RETRY_PARTITION_COUNT;
Funsaized
  • 1,972
  • 4
  • 21
  • 41

1 Answers1

0

Got it. This works:

@Value("${spring.cloud.stream.kafka.bindings.myNamedChannel-in-0.consumer.dlq-partitions}")
private int CONTEXT_RETRY_PARTITION_COUNT;
Funsaized
  • 1,972
  • 4
  • 21
  • 41