Skip to content

Commit

Permalink
split from broadway/broadway-saga (#1)
Browse files Browse the repository at this point in the history
* split from broadway/broadway-saga

* test with MongoDB and docker compose

* new namespace
  • Loading branch information
othillo authored Jan 23, 2018
1 parent ab261bf commit 538dc0a
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 32 deletions.
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
broadway/broadway-saga
======================
broadway/saga-state-mongodb
===========================

Proof-of-concept component providing saga functionality to your application.

This component provides saga state and metadata management and a manager that
can be used to wake up and start sagas.
Saga state persistence for [broadway/broadway-saga](https://github.com/broadway/broadway-saga) using MongoDB.

> Note: this component is highly experimental.
# Installation

```
$ composer require broadway/broadway-saga
$ composer require broadway/saga-state-mongodb
```

Testing
-------
For testing you need a running MongoDB instance.
To start a local MongoDB you can use the provided [docker-compose.yml](https://docs.docker.com/compose/compose-file/):

```
docker-compose up -d
```

> Note: to use MongoDB on PHP7 you will also need to install `alcaeus/mongo-php-adapter`
To run the tests:

```
./vendor/bin/phpunit
```
24 changes: 10 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
{
"name": "broadway/broadway-saga",
"description": "Proof-of-concept component providing saga functionality to broadway/broadway.",
"name": "broadway/saga-state-mongodb",
"description": "Saga state persistence for broadway/broadway-saga using MongoDB",
"license": "MIT",
"require": {
"php": ">=7.0",
"broadway/broadway": "^2.0",
"broadway/broadway-saga": "^0.4",
"doctrine/mongodb": "^1.0",
"beberlei/assert": "^2.0",
"alcaeus/mongo-php-adapter": "^1.1"
},
"require-dev": {
"phpunit/phpunit": "^4.8",
"ramsey/uuid": "^3.3"
},
"authors": [
{
"name": "Alexander",
Expand All @@ -34,23 +39,14 @@
"homepage": "http://labs.qandidate.com/"
}
],
"require-dev": {
"doctrine/mongodb": "^1.0",
"phpunit/phpunit": "^4.8",
"ramsey/uuid": "^3.3"
},
"suggest": {
"doctrine/mongodb": "For persisting saga states",
"alcaeus/mongo-php-adapter": "Polyfill for Mongo extension on PHP 7"
},
"autoload": {
"psr-4": {
"Broadway\\Saga\\": "src/"
"Broadway\\Saga\\State\\MongoDB\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Broadway\\Saga\\": "test/"
"Broadway\\Saga\\State\\MongoDB\\": "test/"
}
},
"extra": {
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: '3.2'
services:
mongodb:
image: mongo:3
ports:
- "27017:27017"
5 changes: 0 additions & 5 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,4 @@
<directory suffix=".php">./src/</directory>
</whitelist>
</filter>
<groups>
<exclude>
<group>mongo</group>
</exclude>
</groups>
</phpunit>
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
* file that was distributed with this source code.
*/

namespace Broadway\Saga\State;
namespace Broadway\Saga\State\MongoDB;

use Broadway\Saga\State;
use Broadway\Saga\State\Criteria;
use Broadway\Saga\State\RepositoryException;
use Broadway\Saga\State\RepositoryInterface;
use Doctrine\MongoDB\Collection;

class MongoDBRepository implements RepositoryInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@
* file that was distributed with this source code.
*/

namespace Broadway\Saga\State;
namespace Broadway\Saga\State\MongoDB;

use Broadway\Saga\State\Testing\AbstractRepositoryTest;
use Doctrine\MongoDB\Configuration;
use Doctrine\MongoDB\Connection;

/**
* @group mongo
*/
class MongoDBRepositoryTest extends AbstractRepositoryTest
{
protected static $dbName = 'doctrine_mongodb';
Expand Down

0 comments on commit 538dc0a

Please sign in to comment.