Streaming task events
We have been successful previously in running the new microservice using Compose. However, we would like to know how many times a location has been visited or how many tasks have been created over time.
This is a data-driven task. We want to capture and stream information about our application. Redis provides us with streams. By using streams, our application can stream data that can later be processed by another application and create the analytics of our choice.
This will be possible with a simple adaptation to our code. Once a task is added, a message shall be published to a Redis stream.
We will add a service to the Task Manager that will be able to stream events. For now, only when adding a task will a message be sent.
The following code base is the implementation of the TaskStream
service, which will be responsible for sending messages on task creation:
// Chapter5/task-manager/task/task-service.go:14 [...] type TaskMessage struct { taskId...