Skip to content

Result Worker is a backend worker designed to handle cryptographic operations in a distributed manner. It listens to the message queue, processes the submission and publishes the result to the pub/sub. Also, handles failures by maintaining dead letter queues.

Notifications You must be signed in to change notification settings

priyanshubisht10/result-worker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Result Worker

The Result Worker is an efficient and scalable backend service designed to process student submissions in real time. Built with TypeScript, this worker provides type safety and maintainability, making it a robust solution for submission processing pipelines. This worker is designed to handle the verification of student submissions. It ensures secure validation using cryptographic signatures and facilitates real-time communication through Pub/Sub channels.

Functionalities

  • Queue Listening: Continuously listens to a submissions queue and processes each submission one at a time.
  • Signature Verification: Verifies the signature of each submission using the student's public key.
  • Positive Processing: Publishes verified submissions (successful verification) to the positive-processed channel of the Pub/Sub system, along with the student ID.
  • Negative Processing: Publishes unverified submissions (failed verification) to the negative-processed channel of the Pub/Sub system.
  • Final Queue Push: Pushes successfully verified submissions into the final-submissions queue for further processing.

Prerequisites

  1. Node.js (version >= 16)
  2. Redis
  3. Docker
  4. Git

Installation

Follow these steps to set up the Result Worker in your environment:

  1. Clone the repository:
    git clone https://github.com/priyanshubisht10/result-worker.git
    cd result-worker
  2. Install dependencies:
    npm install
  3. Build:
    tsc -b
  4. Set up environment variables: Create a .env file in the root directory and define the following variables
    DATABASE=
    DATABASE_PASSWORD=
  5. Start Redis-Stack in a Docker Container:
    docker run -d --name redis-stack -p 6379:6379 -p 8001:8001 redis/redis-stack:latest
    docker exec -it redis-stack redis-cli
  6. Start the worker:
    node dist/app.js
  7. Verify the setup: If everything is set up correctly, you should see the following log in the terminal:
    DB connection successful!
    Connected to Redis successfully

Additional Resources

For a detailed explanation of the architecture, functionality, and use cases of this worker, check out this Medium article by me:
https://priyanshubisht10.medium.com/workers-and-message-queues-18483fe287dd

About

Result Worker is a backend worker designed to handle cryptographic operations in a distributed manner. It listens to the message queue, processes the submission and publishes the result to the pub/sub. Also, handles failures by maintaining dead letter queues.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published