Invoke an api with webClient in projection

I invoke an api with webClient in the projection, the api returns a Mono of String, with the below example the api is not invoked, any idea ?

@Component
@RequiredArgsConstructor
public class UserEventHandler {

    private static final WebClientErrorHandler ERROR_HANDLER = WebClientErrorHandler.builder()
            .isFunctionalStatus(PRECONDITION_REQUIRED::equals)
            .build();

    private final WebClient webClient;

    @EventHandler
    public Mono<String> on(UserCreated evt) {
        return getUser().flatMap(it -> {
            System.out.println(it);
            return Mono.just(it);
        });
    }

    public Mono<String> getUser() {
        return webClient.get()
                .retrieve()
                .onStatus(HttpStatus::isError, ERROR_HANDLER::handleError)
                .bodyToMono(String.class);
    }

}

Hi Rayen,

Currently we are not supporting reactive(Mono or Flux) return types in event handlers. So for now, you will need to block in the event handler.

Very likely with Axon Framework 5 you can have reactive return types.