Sends notifications to users at their specified time through email, by filtering out previously notified challenges and filtering in by specified tags(Ex: NodeJs, Java) from TopCoder RSS Feed.
TRY IT OUT https://custom-built.dev/app/tpcn
Framework: Spring Boot.
Databse: MongoDB.
- On app start up, a notification task is scheduled at a fixed rate, set through
schedule_rateproperty. - This will at each invocation divides the
schedule_rateinto equal sections, set throughschedule_sectionsproperty. - For each section it schedules an task using
java.util.concurrent.ScheduledExecutorService. - These tasks wake up at their intervals and fetch all users scheduled in this interval from the database and send notifications to them through their emails.
- The variance between user scheduled time and actual notification time can be tuned by adjusting
schedule_sectionsproperty. - For example: If a variance of +/- 10 min is acceptable, then you can set
schedule_rateas 1800000(30 min in ms) andschedule_sectionsas 3. schedule_sectionsproperty should be inline withtask_schedulermax pool size in AppConfig.
- This app uses JWT access tokens to identify users between requests, signed using SHA256withECDSA.
- Implementation of JWT access token authentication is based on RFC7519.
- App has admin endpoint which can be accessed by admin users to get error log and summary of successful/un-successful messages.
- When exceptions are raised in the app, they are gracefully handled and details are asynchronously logged in db.
- Install and start mongodb, and update
db.hostanddb.portproperties inapplication.propertiesfile. - Create 256 bit EC key and store it in JKS format.
$ keytool -genkeypair -keyalg EC -keysize 256 -sigalg SHA256withECDSA -storetype JKS -keystore test.jks -alias test- Update keystore alias, file and password in
JKS_KEYSTORE_ALIAS,JKS_KEYSTORE_FILEandJKS_KEYSTORE_PASSWORDproperties inapplication.propertiesfile or as ENV variables. - App uses Gmail STMP server to send mail, please provide Gmail credentials as
APP_SENDER_MAILandAPP_SENDER_MAIL_PASSWORDENV variables. - Update
schedule_ratein milliseconds andschedule_sectionsproperties inapplication.propertiesto your choice. - Set the app log level by
logging.level.com.appproperty. - Run the db init scripts in build-scripts/mongodb folder
$ cd build-scripts/mongodb
$ mongo db-colls-test-init.js
$ mongo db-colls-init.js- db-colls-test-init.js creates collections for unit test cases.
- Build the app using
mvn installcommand and run the jar file by providingLOG_HOMEsystem property to store logs or run by AppRunner main method from your IDE. - To run as docker container
cdinto build-scripts/server paste the jar previously built into this folder and from build folder run build.sh by providing these three arguments:- path to store mongodb database data
- path to store logs
- app version
Example
$ ./build.sh /var/app/tpcn/db /var/app/tpcn/logs 2.3- Import postman collection and environment in
POST_MANfolder to check and get info about API.
- App main root package is
com.appwhich containsAppRunnerwhich initializes the app. - Sub packages
com.app.configfor app configuration,com.app.controllerfor app REST controllers,com.app.controlleradvicefor controller advices,com.app.convertersfor http message converters,com.app.daofor app data access objects,com.app.exceptionfor app exception classes,com.app.interceptorsfor app http interceptors,com.app.modelfor app models,com.app.notifierfor app user notifier,com.app.schedulerfor app scheduler,com.app.servicefor app services,com.app.utilfor app util classes.
- AccessTokenService creates and verifies JWT access tokens.
- StatusService contains async methods to log successful/un-successful events.
- ChallengeNotificationScheduler schedules notifications at fixed rate.
- ChallengeNotifier notifies new challenges by filtering out old challenges and filtering in by tags.
- AuthInterceptor verifies the access token of incoming requests.
- Add option to change challenge type to develop/design.
- Make build script for windows.