2 years ago
#64256
greenstreetmatt
How to capture timings for spring cloud stream composite functions
I have a spring cloud stream app chaining together some functions. I need a nice way to log time taken for each function without having to wrap the logic for each in log and timing statements. I can do it if I write the function as an anonymous inner class and annotate the apply method but its a bit ugly
spring: cloud: function: definition: f1|f2|f3
@Bean
public Function<Message<String>, Message<String>> f1(){
return f -> {
do stuff
return f;
};
}
public Function<Message<String>, Message<String>> f1(){
return new Function<Message<String>, Message<String>>(){
@LogTiming(name = f1)
public Message<String> apply(Message<String> msg){
}
Any tips/examples would be great
java
spring-cloud-stream
spring-cloud-function
0 Answers
Your Answer