Challenge Overview
Notification server will receive messages from Kafka that are in fact events (message posted, challenge posted, etc) and it has to 'unroll' the event into specific notifications for each user that should receive it (for Connect that will be all project members, for challenge pages that will be challenge registrants, etc).
Each notification will have just two fields 'type':String (same as originating Kafka topic name) and contents:Json.
Each user will also have a 'notifications profile' with settings(on/off) for different notification delivery mechanisms (Email, SMS, Desktop, etc) for each of the message types( project.created, challenge.created, message.posted, etc). We will build the notification delivery jobs in the next challenges.
The notifications server will have the following features:
- List all notifications for a user
- Mark a notification as read
- Mark all notifications as read
- Get notification settings
- Update notification settings
As we want each of the client apps to have its own notification server, it should be implemented as a module that can simply be instantiated and configured with logic on how to unroll the events into notifications. So for example, we could create a new notifications server for Connect with
//set configuration (port, keys, etc)
notificationsServer.setConfig(config)
//provide logic for unrolling the events into notifications
notificationsServer.addTopicHandler('topicName',handler);
//start the server
notificationsServer.start()
Note that it should be possible to deploy multiple instances of the notification server and use a load balancer if needed, so don't create any 'state' data in the notification server. Also, different instances should NOT process the same message from Kafka.
As part of this challenge you should also implement the notifications server for Topcoder Connect. To unroll the messages, call the api.topcoder-dev.com/v4/projects/PROJECT_ID/ endpoint using project_id field from the Kafka message. To call the api you have to add authorization header "authorization: Bearer + TOKEN" where token is a JWT for an admin user. you can use "___FILL___ADMIN___TOKEN___HERE" for testing. The server will be listening for these messages
notifications.connect.project.created
notifications.connect.project.updated
notifications.connect.message.posted
notifications.connect.message.edited
notifications.connect.message.deleted
notifications.connect.project.submittedForReview
Notifications BUS API server and Kafka are deployed to Heroku adn you can use them for testing. Sample topics are already created. Server details are posted in the forums.
Final Submission Guidelines
Submit a complete source code for the service and the specific Connect implementationSubmit a Deployment guide for deploying locally and on Heroku
Submit a Postman collection for verifying the endpoints (and instructions to verify the messages end up in kafka queue)
Submit a Swagger API spec