Wednesday, August 24, 2022

mixing spring boot web and webflux

Following how to use reactor scheduler in micro-services, things becomes even more tricky if you mix spring boot web and webflux.

subscribeOn
[nio-8090-exec-1] -----Service : foo
[oundedElastic-1] EmailServiceClient : Sending email notification
[ctor-http-nio-2] EmailServiceClient : Sent email notification

publishOn
[nio-8090-exec-1] EmailServiceClient : Sending email notification
[nio-8090-exec-1] -----Service : foo
[oundedElastic-1] EmailServiceClient : Sent email notification

publishOn + subscribeOn
[nio-8090-exec-1] -----Service : foo
[oundedElastic-1] EmailServiceClient : Sending email notification
[oundedElastic-2] EmailServiceClient : Sent email notification

Mono.just + subscribeOn
[nio-8090-exec-1] EmailServiceClient : Sending email notification
[nio-8090-exec-1] -----Service : foo
[ctor-http-nio-2] EmailServiceClient : Sent email notification

Mono.just + publishOn
[nio-8090-exec-1] EmailServiceClient : Sending email notification
[nio-8090-exec-1] -----Service : foo
[ctor-http-nio-2] EmailServiceClient : Sent email notification