0

We are upgrading the cloud stream library, converting it to a functional style from imperative.

@StreamListener(target = Channel.ALPHA, condition = "headers['type']=='ALPHA1'" ...)
handleAlpha1{...}

@StreamListener(target = Channel.ALPHA, condition = "headers['type']=='ALPHA2'" ...)
handleALpha2{...}

...

@StreamListener(target = Channel.INPUT_ALPHA, condition = "headers['type']=='Alphan'" ...)
handleAlphan{...}

Similarly, there are other channels also

    @StreamListener(target = Channel.BETA, condition = "headers['type']=='BETA1'" ...)
handleBeta1{...}

@StreamListener(target = Channel.BETA, condition = "headers['type']=='BETA2'" ...)
handleBeta2{...}

...

@StreamListener(target = Channel.BETA, condition = "headers['type']=='BETAN'" ...)
handleBetan{...}

Converting this into a functional style will create

  1. N functions for Alpha channel
  2. N functions for the Beta channel which will result in properties file huge and function resolution on header based complicated and which function to define here :
spring.cloud.stream.bindings.inbound-alpha-events.group=alpha-channel-group
spring.cloud.stream.bindings.inbound-alpha-events.destination=${spring.kafka.alpha.topic}
spring.cloud.stream.bindings.inbound-alpha-events.consumer.header-mode=headers
spring.cloud.stream.bindings.inbound-alpha-events.content-type=application/json
spring.cloud.stream.kafka.bindings.inbound-alpha-events.consumer.autoCommitOffset=false
secret129
  • 191
  • 1
  • 10

0 Answers0