diff --git a/readme.md b/readme.md index c5ead55..0b16a64 100644 --- a/readme.md +++ b/readme.md @@ -63,6 +63,8 @@ Queues are defined in the config file. Pass them as an associative array: `[name ### Add jobs +Add the following code into a controller or where ever you want to execute it. + ```php $myQueue = kqQueue("queuename"); // "queuename must be the same as set in the options $myJob = kqJob([ // Pass the variables needed in the handler @@ -72,6 +74,28 @@ $myJob = kqJob([ // Pass the variables needed in the handler $myQueue->addJob($myJob); ``` +For testing purposes create a route + +```php +// config.php +'routes' => [ + [ + 'pattern' => 'addtokirbyqueue/queuename', + 'action' => function () { + $myQueue = kqQueue("queuename"); // "queuename must be the same as set in the options + $myJob = kqJob([ // Pass the variables needed in the handler + 'foo' => "foo", + 'bar' => "bar", + ]); + $myQueue->addJob($myJob); + exit; + }, + ] + ] +``` + +and then call http://localhost/addtokirbyqueue/queuename to fill the queue + ### Schedule jobs ```php @@ -106,4 +130,4 @@ This plugin is provided "as is" with no guarantee. Use it at your own risk and a [MIT](https://opensource.org/licenses/MIT) -It is discouraged to use this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech. \ No newline at end of file +It is discouraged to use this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.