We need to create a data listener that will collect and store data from streams, so that we then can make a decision if something is breaking news or not when the API is being queried.
Acceptance criteria
- Aggregate and collect following data per article in redis:
- Versions -> list
- Key: article:{porject_id}:{article_id}:versions
- Value: list of JSON objects with the schema:
- identifier - id of the revision
- editor - name of the editor
- date_created - date the revision was created
- Expiration: 48h
- Description: on every edit add the version.identifier to the head of the list, then by counting the list you'll get number of edits
- Date Created -> timestamp
- Key: article:{porject_id}:{article_id}:date_created
- Value: string
- Expiration: 48h
- Date Namespace Moved -> timestamp
- Key: article:{porject_id}:{article_id}:date_namespace_moved
- Value: string
- Expiration: 48h
- Versions -> list
- Data collection for the article starts when article-create or article-move event was emitted.
ToDo
- listen to aws.event-bridge.article-create.v1, aws.event-bridge.article-move.v1 and aws.event-bridge.article-update.v1 topics
- hide the implementation behind interface of getters and setters and make it a library
Notes
- create the keys described above only when received article-create or article-move event
- on article-update just check for a key, if exists - update