spring.cloud.stream.function.autodetect=true (default setting) for spring-webflux app with server.forward-headers-strategy=FRAMEWORK can't work
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 25/100
- Tipo de issue
- Bug
- Clareza
- Precisa de esclarecimento
- Status de atividade
- Estagnada
- Stack de tecnologia
- java, spring, spring-boot
- Domínio
- backend, distributed-systems
Direção de pesquisa
Nenhum arquivo-fonte ou teste é mencionado. Comece reproduzindo o caso do Spring WebFlux com server.forward-headers-strategy=FRAMEWORK e spring.cloud.stream.function.autodetect habilitado; em seguida, rastreie como ForwardedHeaderTransformer entra na descoberta de beans funcionais e no binding. O trabalho estará concluído quando os cenários descritos de somente saída e de um único bean funcional não criarem mais um consumer espúrio nem fizerem a autodetecção falhar, enquanto o comportamento pretendido de configuração zero continuar definido.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Describe the issue
Using a spring-webflux app with server.forward-headers-strategy=FRAMEWORK, autoconfiguration provides a ForwardedHeaderTransformer bean which breaks all use cases of spring.cloud.stream.function.autodetect :
- if you have only output-bindings, a queue is createded and a consumer is registered on this queue which noone ever wants. If you send a message to this queue, you get
java.lang.ClassCastException: class [B cannot be cast to class org.springframework.http.server.reactive.ServerHttpRequest ([B is in module java.base of loader 'bootstrap'; org.springframework.http.server.reactive.ServerHttpRequest is in unnamed module of loader 'app')
- if you had a single java.util.function.* bean and relied on autodetection, it doesn't work.:
17:59:09.253 [main] WARN org.springframework.cloud.function.context.catalog.BeanFactoryAwareFunctionRegistry - Multiple functional beans were found [forwardedHeaderTransformer, myConsumer], thus can't determine default function definition. Please use 'spring.cloud.function.definition' property to explicitly define it.
To Reproduce
Steps to reproduce the behavior:
see above
all versions
Additional context
In the docs there is the following note:
In the event you only have single bean of type java.util.function.[Supplier/Function/Consumer], you can skip the spring.cloud.function.definition property, since such functional bean will be auto-discovered. However, it is considered best practice to use such property to avoid any confusion. Some time this auto-discovery can get in the way, since single bean of type java.util.function.[Supplier/Function/Consumer] could be there for purposes other then handling messages, yet being single it is auto-discovered and auto-bound. For these rare scenarios you can disable auto-discovery by providing spring.cloud.stream.function.autodetect property with value set to false.
To me, this would have been a good idea if there were really no easy cases where autodection breaks down. It depends on what "rare" means of course, but just a plain webflux springboot app with a single nonexotic property "server.forward-headers-strategy" doesn't seem to be that rare.
So maybe just make autodetection opt-in ? But then it doesn't make much sense, autodetection is for zero config (onboarding), so it's not interesting to add explicit autodetection=true configuration just to avoid some other configuration..
So maybe just delete autodetection entirely? You would lose the easy zero config onboarding.
Or make the autodection really reliable:
- maybe the autodetection should only happen when there is zero spring.cloud.stream.bindings or output-bindings configuration ? zeroconfig onboarding would still work (unless the user chose webflux+forward-headers-strategy=FRAMEWORK to try it out) and normal applications with only output-bindings wouldn't get the spurious consumer
- maybe find a way to exclude all "standard" beans. Based on the package ? Based on the function Signature (who would use Function<HttpServletRequest, HttpServletRequest>) ? Based on something else ?
- another idea ?
Cheers,
Jon
- Linguagem predominante
- Java
- Estrelas
- 1.1k
- Forks
- 657
- Merge médio
- 1d 18h
- PRs com merge (30d)
- 8
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de spring-cloud/spring-cloud-stream
-
Move the spring-cloud-commons version and BOM import from the bus parent to the stream parentTalvez já em andamento @olegz assumiu hoje. Abertatask
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
spring-cloud/spring-cloud-stream#3355 ·
Mantenedores costumam responder em até 1 dia
-
Kafka binder skips failed input records when DLQ publication failsTalvez já em andamento @itsgourav62 assumiu há 2 dias. Abertabug
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 55/100
spring-cloud/spring-cloud-stream#3350 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Clarify support for manual ack/nack with batch mode + DLQ; potential bug in acknowledge(index) pathAberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
spring-cloud/spring-cloud-stream#3189 · 3 comentários · 1 reação ·
Mantenedores costumam responder em até 1 dia
-
Add RecordInterceptor support for Kafka Streams binderTalvez livre de novo Um pull request para esta issue foi fechado sem ser mesclado. Abertaenhancement
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
spring-cloud/spring-cloud-stream#3188 · 4 comentários ·
Mantenedores costumam responder em até 1 dia
-
task
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 48/100
spring-cloud/spring-cloud-stream#3187 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
Todas as issues de spring-cloud/spring-cloud-stream
Issues semelhantes
-
enhancement infra
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 67/100
Mantenedores costumam responder em até 1 dia
-
5.0.x backport bug
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 68/100
spring-cloud/spring-cloud-function#1569 ·
Mantenedores costumam responder em até 1 dia
-
NoSuchMethodError in the circuit breaker since 3.103.0 when resilience4j 2.x is on the classpathAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
oracle/oci-java-sdk#803 ·
-
area:cpan-port area:performance bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
fglock/PerlOnJava#2230 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100