Fixed type checking for Publisher<Non-Message>; fixes gh-2079
This commit is contained in:
@@ -134,7 +134,7 @@ public class SleuthBenchmarkingStreamApplication {
|
||||
@Bean(name = "myFlux")
|
||||
@ConditionalOnProperty(value = "spring.sleuth.function.type", havingValue = "DECORATE_ON_EACH",
|
||||
matchIfMissing = true)
|
||||
public Function<Flux<Message<String>>, Flux<Message<String>>> onEachFunction() {
|
||||
public Function<Flux<String>, Flux<String>> onEachFunction() {
|
||||
log.info("on each function");
|
||||
return new SleuthFunction();
|
||||
}
|
||||
@@ -142,14 +142,14 @@ public class SleuthBenchmarkingStreamApplication {
|
||||
@Bean(name = "myFlux")
|
||||
@ConditionalOnProperty(value = "spring.sleuth.function.type", havingValue = "DECORATE_QUEUES",
|
||||
matchIfMissing = true)
|
||||
public Function<Flux<Message<String>>, Flux<Message<String>>> decorateQueuesFunction() {
|
||||
public Function<Flux<String>, Flux<String>> decorateQueuesFunction() {
|
||||
log.info("decorate queues function");
|
||||
return new SleuthFunction();
|
||||
}
|
||||
|
||||
@Bean(name = "myFlux")
|
||||
@ConditionalOnProperty(value = "spring.sleuth.function.type", havingValue = "DECORATE_ON_LAST")
|
||||
public Function<Flux<Message<String>>, Flux<Message<String>>> onLastFunction() {
|
||||
public Function<Flux<String>, Flux<String>> onLastFunction() {
|
||||
log.info("on last function");
|
||||
return new SleuthFunction();
|
||||
}
|
||||
@@ -269,18 +269,18 @@ class SleuthNonReactiveFunction implements Function<String, String> {
|
||||
|
||||
}
|
||||
|
||||
class SleuthFunction implements Function<Flux<Message<String>>, Flux<Message<String>>> {
|
||||
class SleuthFunction implements Function<Flux<String>, Flux<String>> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SleuthFunction.class);
|
||||
|
||||
static final Scheduler SCHEDULER = Schedulers.newParallel("sleuthFunction");
|
||||
|
||||
@Override
|
||||
public Flux<Message<String>> apply(Flux<Message<String>> input) {
|
||||
public Flux<String> apply(Flux<String> input) {
|
||||
return input.doOnEach(signal -> log.info("Got a message"))
|
||||
.flatMap(s -> Mono.delay(Duration.ofMillis(1), SCHEDULER).map(aLong -> {
|
||||
log.info("Logging [{}] from flat map", s);
|
||||
return MessageBuilder.withPayload(s.getPayload().toUpperCase()).build();
|
||||
return s.toUpperCase();
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -56,9 +56,9 @@ import org.springframework.messaging.support.MessageBuilder;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@Measurement(iterations = 1, time = 1)
|
||||
@Warmup(iterations = 1, time = 1)
|
||||
@Fork(1)
|
||||
@Measurement(iterations = 10, time = 1)
|
||||
@Warmup(iterations = 10, time = 1)
|
||||
@Fork(4)
|
||||
@BenchmarkMode(Mode.SampleTime)
|
||||
@OutputTimeUnit(TimeUnit.MILLISECONDS)
|
||||
@Microbenchmark
|
||||
|
||||
Reference in New Issue
Block a user