question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Application fails to start with Spring Cloud Stream + multiple output bindings for function

See original GitHub issue

A 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:closed
  • Created 2 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
TYsewyncommented, Dec 14, 2021

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)) to Flux<Message> we could check the instance type of the result: Flux, Tuple or Iterable (Tuple2…8 are implementing this interface). In case it is a Tuple we could get all Flux from the tuple as an array, wrap each of them, and return a new Tuple based on the size of the array.

1reaction
marcingrzejszczakcommented, Dec 14, 2021

Can you check the latest snapshots?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found