Accessing spring cloud function rabbit binding details

151 views Asked by At

I'm attempting to update the "Springwolf" library (used to document async API definitions) to support rabbit consumer listeners using spring cloud functions for spring cloud stream. In order to accomplish this I need to find from application context

  1. spring cloud functions defined.
  2. map this to a channel name
  3. map that channel name to its binding.. hopefully pulling out exchange, queue and routing key values.

I've been able to successfully track down the defined functions, get the expected payload type of the function, and map that to a channel name using defined values in application.properties.

Depending on our application properties are set up I can get the other info from there but this is not always possible. Is there a way I can pull this data from defined spring beans.

I've found bean "bindingService" has a private field "consumerBindings" which has a field "destination" which has a field "bindings" and those bindings have all of the details that I need... but given they're private and buried I don't think this would be a good way to go.

I've also found spring.cloud.stream-org.springframework.cloud.stream.config.BindingServiceProperties has a "getBindings" method on it, but those values appear to be incomplete. for instance with a rabbit consumer defined as below the "group name" is generated randomly but its name is not available from the Bindings provided in BindingServiceProperties

spring.cloud.stream.bindings.anotherConsumerMethod-in-0.destination=someDestination2 spring.cloud.stream.bindings.anotherConsumerMethod-in-0.consumer.bindingRoutingKey=testgroup.testDestination.queue2

Any help/guidance would be awesome... also if the answer is "you can't do this" I completely understand.

0

There are 0 answers