Springfox 3.0.0 brokes spring-cloud-stream
See original GitHub issuePlease take the time to search the repository, if your question has already been asked or answered.
Springfox version: 3.0.0
What kind of issue is this?
- Bug report. If you’ve found a bug, spend the time to write a failing test. Bugs with tests or
steps to reproduce get fixed faster. Here’s an example: https://gist.github.com/swankjesse/6608b4713ad80988cdc9
- spring xml/java config that is relevant
-
springfox specific configuration if it makes senseNot special configuration is applied, just add the springfox dependency - include any output you’ve received; logs, json snippets etc.; and what the expected output should be
- if you have a repo that demonstrates the issue for bonus points! See this example
Springfox version: 3.0.0 Github project: https://github.com/SrMouraSilva/course-spring-microservices/tree/springfox-broken-spring-cloud-stream
What kind of issue is this?
When I add Springfox 3.0.0 dependency, spring-cloud-stream don’t find the Consumers anymore.
Instruction
The code is based on a simplest example (article, video).
# Go to code
git clone https://github.com/SrMouraSilva/course-spring-microservices
cd course-spring-microservices/
git checkout springfox-broken-spring-cloud-stream
# Starts the rabbitmq server with docker
docker run -d --name rabbit -h rabbit -p 5672:5672 -p 15672:15672 rabbitmq:3-management
# Starts a consumer server
cd event-driven/consumer-a-service/
mvn spring-boot:run
In my source code, the Springfox dependency is commented (event-driven/consumer-a-service/pom.xml
), then in the log appears:
2020-10-08 11:21:51.134 INFO 86492 --- [ main] o.s.c.f.c.c.SimpleFunctionRegistry : Looking up function '' with acceptedOutputTypes: []
2020-10-08 11:21:51.141 INFO 86492 --- [ main] o.s.c.f.c.c.SimpleFunctionRegistry : Looking up function 'callmeEventConsumer' with acceptedOutputTypes: []
2020-10-08 11:21:51.154 INFO 86492 --- [ main] o.s.c.f.c.c.SimpleFunctionRegistry : Looking up function 'callmeEventConsumer' with acceptedOutputTypes: []
2020-10-08 11:21:51.155 INFO 86492 --- [ main] o.s.c.f.c.c.SimpleFunctionRegistry : Looking up function 'callmeEventConsumer' with acceptedOutputTypes: []
2020-10-08 11:21:51.303 INFO 86492 --- [ main] o.s.c.s.m.DirectWithAttributesChannel : Channel 'consumer-a-service.callmeEventConsumer-in-0' has 1 subscriber(s).
2020-10-08 11:21:51.318 INFO 86492 --- [ main] o.s.c.f.c.c.SimpleFunctionRegistry : Looking up function 'callmeEventConsumer' with acceptedOutputTypes: []
2020-10-08 11:21:51.379 INFO 86492 --- [ main] o.s.i.endpoint.EventDrivenConsumer : Adding {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
2020-10-08 11:21:51.379 INFO 86492 --- [ main] o.s.i.channel.PublishSubscribeChannel : Channel 'consumer-a-service.errorChannel' has 1 subscriber(s).
2020-10-08 11:21:51.379 INFO 86492 --- [ main] o.s.i.endpoint.EventDrivenConsumer : started bean '_org.springframework.integration.errorLogger'
But when is uncommeted, appears:
2020-10-08 13:58:30.486 INFO 98308 --- [ main] o.s.c.f.c.c.SimpleFunctionRegistry : Looking up function '' with acceptedOutputTypes: []
Apparently the dependence on springfox somehow stops the search for Consumer
/Function
beans carried out by spring-cloud-stream
, making it impossible to receive messages.
If you wish, I can do a simpler project that will test the problem.
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (2 by maintainers)
Top GitHub Comments
This is because springfox registers a
Supplier
@Bean
:spring-cloud-stream can only work without configuration if exactly one
Function<?>
,Consumer<?>
orSupplier<?>
bean exists.Since it can’t disambiguate, no binding is implied.
You have to add the property
spring.cloud.function.definition=consumerMethodName
to indicate which method(s) to bind.solve my problem