Challenge Overview
Challenge objectives
-
Create event processors that process messages from event bus (Kafka) and generate multiple notifications for Topcoder users
Project Background
Topcoder notifications repository hosts the API and processors for enabling notifications in various Topcoder apps. Currently it is limited to provide this facility to the Connect application. In this challenge we aim to create structure for generic event processors that read a message from the event bus, and produce one or more notifications for relevant users.
Technology Stack
-
NodeJs
-
Kafka
-
Postgres
Code Access
Base code can be accessed at
-
https://github.com/topcoder-platform/tc-notifications - feature/general-purpose-notifications-usage branch
Individual requirements
-
Update generic event handler
Here is a top level diagram of notifications event processing
Consumer (already created in ./consumer.js) will read the messages from Kafka and pass each received message to the configured message handlers. Each handler can produce any number of actual notifications (one to many) which will then be persisted to database. Our first goal in this challenge is to create handler mapping config (so that each event can be handled by multiple handlers) and update the consumer to call each of the configured handlers (using promises).
Error handling is very important - errors should be logged with as much info as available, but error in one handler should not in any case lead to errors in handling the event by other handlers.
Event processors will be created in src/processors (ex src/processors/challenge/processor1.js, src/processors/forum/processor2.js, src/processors/index.js) and handler mapping should be defined in config/default.js. All new services needed by the processors should be created in src/services directory.
-
Create sample processors
Create two processors to showcase the new behavior:
-
“Notifications.community.challenge.created” with the following message body
{
topic: "notifications.community.challenge.created"
originator: "tc-direct",
timestamp: (new Date()).toISOString(),
"mime-type": "application/json",
"payload": {
challengeId: challenge.id,
challengeTitle: challenge.title
challengeUrl: challenge.url,
userId: userId,
initiatorUserId: userId,
}
}
To get members to notify for this event, call the member search endpoint to find members with skills matching the launched challenge. See forums for exact api call details
-
“Notifications.community.challenge.phasewarning” with following message body
{
topic: "notifications.community.challenge.phasewarning"
originator: "tc-autopilot",
timestamp: (new Date()).toISOString(),
"mime-type": "application/json",
"payload": {
challengeId: challenge.id,
challengeTitle: challenge.title
challengeUrlUrl: challenge.url,
phase : challenge.currentPhase,
remainingTime: seconds
userId: userId,
initiatorUserId:.userId,
}
}
To get members to notify for this event, call the challenge details endpoint and notify all challenge registrants. See forums for exact api call details
General requirements
You will need to deploy a local Kafka instance and send the messages to it manually - connecting to Topcoder Kafka instance is not possible in this challenge. No changes are expected to code in connect/*, src/models/* or src/common/*. Follow the existing code style - comment the code and follow eslint configuration.
Submission Guidelines
-
Git patch
-
Readme/Verification guide
-
Winner will be required to create a PR
Future work
-
Development of many event handlers
-
Email handling updates (templates, scheduling)
Final Submission Guidelines
-
Git patch
-
Readme/Verification guide
-
Winner will be required to create a PR