Skip to content

Commit

Permalink
Merge pull request #27 from urbanindo/add-db-redis-queue
Browse files Browse the repository at this point in the history
[WIP] Refactor queue and add DB and Redis implementation.
  • Loading branch information
petrabarus committed Feb 4, 2016
2 parents e98858d + dd795fe commit 64365b1
Show file tree
Hide file tree
Showing 44 changed files with 2,792 additions and 716 deletions.
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ php:
- 5.6
- hhvm
- nightly

services:
- mysql
- redis-server

script: ./vendor/bin/phpunit

before_script:
#MySQL database init
- mysql -uroot -e "CREATE DATABASE IF NOT EXISTS test;"
- mysql -uroot -e "CREATE USER 'test'@'localhost' IDENTIFIED BY 'test';"
- mysql -uroot -e "GRANT ALL PRIVILEGES ON test.* TO 'test'@'localhost' IDENTIFIED BY 'test';"

install:
- travis_retry composer self-update && composer --version
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Change Log
All notable changes to this project will be documented in this file.

## 1.3.0
- Added implementation for DbQueue and RedisQueue.
- Added events for queue.
- Added `purge` method for queue.
- Refactoring code.

## 1.2.3
- Passing scenario for model and active record.

Expand All @@ -25,7 +31,7 @@ All notable changes to this project will be documented in this file.
## 2015-02-25

### Changed
- Shorten `postJob`, `getJob`, `deleteJob`, `runJob` method name to `post`,
- Shorten `postJob`, `getJob`, `deleteJob`, `runJob` method name to `post`,
`fetch`, `delete`, `run`.

### Fixed
Expand Down
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ or add

to the require section of your `composer.json` file.

To use Redis queue or RabbitMQ, you have to add `yiisoft/yii2-redis:*` or
`videlalvaro/php-amqplib: 2.5.*` respectively.

## Setting Up

After the installation, first step is to set the console controller.
Expand Down Expand Up @@ -54,7 +57,7 @@ the task in the component. For example, queue using AWS SQS
```php
'components' => [
'queue' => [
'class' => 'UrbanIndo\Yii2\Queue\SqsQueue',
'class' => 'UrbanIndo\Yii2\Queue\Queues\SqsQueue',
'module' => 'task',
'url' => 'https://sqs.ap-southeast-1.amazonaws.com/123456789012/queue',
'config' => [
Expand All @@ -67,6 +70,22 @@ the task in the component. For example, queue using AWS SQS
]
```

Or using Database queue

```php
'components' => [
'db' => [
//the db component
],
'queue' => [
'class' => 'UrbanIndo\Yii2\Queue\Queues\DbQueue',
'db' => 'db',
'tableName' => 'queue',
'module' => 'task',
]
]
```

## Usage

### Creating A Worker
Expand Down Expand Up @@ -237,5 +256,4 @@ To run the tests, in the root directory execute below.

## Road Map

- Add more queue provider such as MySQL, Redis, MemCache, IronMQ, RabbitMQ.
- Add priority queue.
- Add more queue provider such as MemCache, IronMQ, RabbitMQ.
9 changes: 8 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@
},
"require-dev": {
"phpunit/phpunit": "4.6.*",
"phpunit/dbunit": ">=1.2"
"phpunit/dbunit": ">=1.2",
"phpunit/php-code-coverage": "2.2.4",
"fzaninotto/faker": "dev-master",
"flow/jsonpath": "dev-master",
"yiisoft/yii2-coding-standards": "*",
"yiisoft/yii2-redis": "*",
"videlalvaro/php-amqplib": "2.5.*",
"squizlabs/php_codesniffer": "2.*"
},
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit 64365b1

Please sign in to comment.