I have a "user" class which contains a status attribute, I want to display this attribute in a dashboard. when the backend changes this attribute I want the frondEnd to display the new value directly without reloading the page . I use Spring and React
CodePudding user response:
You can use a pub-sub mechanism to achieve this. for example, a kafka topic can be used to sync your changes with the front end.
- while inserting a record in your backend DB, push a message to user-kafka-topic.
- add a user-kafka-consumer in your front-end application. It would consume messages from the user-kafka-topic at runtime.
- you can plan to add you own front-end DB and update the front-end DB.
- use observer pattern in your frontend to to update your UI as soon as your json data for the page changes.