Download the PHP package tina4components/tina4jobsmodule without Composer
On this page you can find all versions of the php package tina4components/tina4jobsmodule. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tina4components/tina4jobsmodule
More information about tina4components/tina4jobsmodule
Files in tina4components/tina4jobsmodule
Package tina4jobsmodule
Short Description This is a package that will allows you to add a redis jobs queue to any tin4 project
License MIT
Informations about the package tina4jobsmodule
Welcome to the Tina4 Jobs Module
This package uses a redis server to manage the jobs and to run them on a schedule. It is designed to be a simple way to manage jobs and to be able to run them on a schedule.
Installation
To install the package you can use the following command
Usage (DATABASE QUEUE)
Usage (REDIS QUEUE - Still in Beta)
There are two variables that you need to set in your .env file
General Usage
When creating a job you need to create a class that implements the Tina4Job
interface and implement the handle()
method.
The handle()
method is the method that will be called when the job is run.
The following is an example of a job that writes a user to a file, All job classes need to implement the Tina4Job interface.
Creating a job is as simple as creating a new instance of TestJob class and adding it to the jobs list.
To run the jobs there is a jobs service in the Tina4Jobs module that you can use to run the jobs.
Running jobs on linux server as a service
To run the jobs on a linux server you can use the following command
Step 1: cd /etc/systemd/system
Step 2: Create a new service file nano tina4jobs.service
and add the following content
Step 3: Reload the systemd daemon systemctl daemon-reload
Step 4: Start the service systemctl start tina4jobs.service
Step 5: Check the status of the service systemctl status tina4jobs.service
Step 6: Enable the service to start on boot systemctl enable tina4jobs.service
Notes:
- You can change the user to the user that you want to run the service as.
- You can change the path to the project directory where the
bin/tina4jobs
file is located. - You can change the description of the service to whatever you want.
- You can change the name of the service to whatever you want.
- To stop the service you can use
systemctl stop tina4jobs.service
Todo
- Need to implement multiple queue names
- Write Tests for all functions and classes
All versions of tina4jobsmodule with dependencies
composer-plugin-api Version ^2.0
tina4stack/tina4php-sqlite3 Version ^2.0
ext-redis Version *
ext-sqlite3 Version *