A video viewed message is an application event that tells another microservice a user has started watching or viewed a video. The video-streaming microservice emits it, while the history microservice records the viewing history. That history can support personal review, resume-watching, and recommendations. section 5.4 section 10.7.5
Common delivery patterns include:
- Send the message directly with an HTTP POST to the history service at http://history/viewed, using JSON such as {"videoPath": "..."}. Handle success and failure callbacks separately. section 5.7.3
- Publish the message indirectly through RabbitMQ. A sender publishes JSON containing videoPath to the viewed queue, and the history service consumes, stores, and acknowledges it. section 5.8.6
- Treat the message as an event so additional microservices can respond later without changing the video-streaming service, preserving decoupling and extensibility. section 10.7.5
Emitting a view during streaming
When the video-streaming service forwards a requested video stream, it calls broadcastViewedMessage(messageChannel, videoId). The message carries the video identifier, and the history service can record it independently. section 10.7.5
