Application fails to start with Spring Cloud Stream + multiple output bindings for function
See original GitHub issueA Spring Cloud Stream function with multiple output bindings uses following signature:
Function<Flux<Integer>, Tuple2<Flux<String>, Flux<String>>>
.
When Sleuth is on the classpath & enabled, the TraceFunctionAroundWrapper
throws a ClassCastException
because it tries to cast the Tuple2
result to Flux
, more specifically on this line.
Release train: 2021.0.0 Sleuth 3.1.0
Sample See https://github.com/TYsewyn/sleuth-multiple-output-streams-fails
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Spring Cloud Stream multiple function supplier issue
This works fine for me. @SpringBootApplication public class So72361424Application { public static void main(String[] args) ...
Read more >Spring Cloud Stream Kafka Binder Reference Guide
Multiple Input Bindings; Multiple Output Bindings; Summary of Function based ... In the latter case, if the topics do not exist, the binder...
Read more >Spring Cloud Stream Reference Guide
Configuring Output Bindings for Partitioning. Configuring Input Bindings for ... A Spring Cloud Stream application consists of a middleware-neutral core.
Read more >Spring Cloud Stream Kafka Binder Reference Guide
Multiple functions in the same application; 2.15.3. ... In addition, this guide explains the Kafka Streams binding capabilities of Spring Cloud Stream.
Read more >Preface - Spring
You now have a fully functional Spring Cloud Stream application that does ... That is because binder does not know the required input...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The problem is with this line of code in
TraceFunctionAroundWrapper
:final Flux<Message> function = ((Flux<Message>) targetFunction.apply(flux));
So instead of immediately casting the result of
targetFunction.apply(flux))
toFlux<Message>
we could check the instance type of the result:Flux
,Tuple
orIterable
(Tuple2…8 are implementing this interface). In case it is aTuple
we could get allFlux
from the tuple as an array, wrap each of them, and return a newTuple
based on the size of the array.Can you check the latest snapshots?