#Server-Sent Events using Spring Web flux and ApplicationEvents

1 messages · Page 1 of 1 (latest)

clever summit
#

Hey everyone,

I am a fairly experienced Java developer. However, I haven't done any reactive programming before.

I have a use case that I need to implement, but seen not to find any helpful material online. So I would like to see if this is solvable the way I am thinking about it or there is a different path that I should take.

I have an simple e-commerce-like system. Where customers place orders and employees of the company have to take some actions.

The employees have a dashboard in the browser that shows a few number fields that show how many orders are in a specific state. e.g. New orders, offers made, offers declined and so on.

I want to update these numbers in realt-time and I found out Server-sent events are a good candidate. However, I want these numbers to be updated whenever an event happens. e.g. an employee makes an offer. This gets saved in the database and when it is saved, then the number of offers made is automatically increased.

I thought about making events and using ApplicationsEvents. But I cannot figure out how to wire the reactive endpoint with an Eventlistener.

Is this the correct way to go about it? If no, what is?

novel stumpBOT
#

This post has been reserved for your question.

Hey @clever summit! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.