This project have the implementation of Bull - queue system and a interface to administrate your jobs - Bull-Board
Deprecated description
You should have docker instaled
- Create a redis container:
docker run --name redis -p 6379:6379 -d -t redis:alpine
- Clone the project:
git clone https://github.com/Luryy/Queue-Bull-Implementation.git
cd Queue-Bull-Implementation
yarn install
yarn start
The aplicacation have two routes:
-
GET /admin/queues
- To see the dashboard that administrate your jobs. -
POST /bull-test
- To create a new job for test. The body must containtteste
with any data, just to be passed to job.- When you send the request you must have one log after 1 second and other after 15 seconds, then you job will be done.
- If your aplication crashes before your job finish, when you restart, the job will be retried.
- If want to change the behavior of the job, see next topic structure.
Here is the project structure:
├── node_modules
├── src
│ ├── jobs
│ │ ├── index.ts
│ │ └── TestJob.ts
│ ├── providers
│ │ └── QueueProvider
│ │ ├── fakes
│ │ │ └── FakeQueueProvider.ts
│ │ ├── implementations
│ │ │ └── BullQueueProvider.ts
│ │ └── models
│ │ └── IQueueProvider.ts
│ ├── app.ts
│ └── server.ts
├── .editorconfig
├── .eslintignore
├── .eslintrc.json
├── .git
├── .gitignore
├── package.json
├── prettier.config.js
├── README.md
├── tsconfig.json
└── yarn.lock
At Providers folder we have the bull implementation, with his interface and fake implementation to future tests.
At Jobs folder will contain all jobs as we want, you could only duplicate TestJob.ts (remember to export at index.ts).
If you want to alter the job behavior, you should change the function handle
to do whatever you want.
To a better understanding you should open the files and see yours responsabilities.
👤 Lucas Yuri
- Github: Luryy
- LinkedIn: Lucas Yuri
Copyright © 2020 Lucas Yuri. This project is MIT licensed.