Skip to content
Advertisement

How to manage a RestEndpoint with Spring Application Events?

I´m developing a spring boot microservice and I´m raising application events to execute my services and do my business stuff. It works well when I listen from Kafka, but also I want to implement an endpoint that returns a response. I raise my application event in the restController but what I don´t know is how to get the result of the service to return the value in my controller.

JavaScript

Advertisement

Answer

You can not get result of your event. Both sync or asyn ApplicationEventPublisher returns void. And your event startes in another thread.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement