Skip to content

Commit

Permalink
Revert "Revert "Revert "Basic routing"" (#46)"
Browse files Browse the repository at this point in the history
This reverts commit e99363d.
  • Loading branch information
etienneroudeix committed Jul 24, 2017
1 parent 504fbea commit 6834ce3
Show file tree
Hide file tree
Showing 19 changed files with 437 additions and 491 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"require": {
"php": "^5.6 || ^7.0",
"reactivex/rxphp": "1.5.3",
"reactivex/rxphp": "^1.1",
"react/react": "0.4.2",
"ramsey/uuid": "^3.5.1",
"nikic/fast-route": "^1.2",
Expand Down
23 changes: 0 additions & 23 deletions examples/future.php

This file was deleted.

51 changes: 51 additions & 0 deletions examples/router.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php
use EventLoop\EventLoop;
use Rxnet\Routing\RoutableSubject;

require __DIR__ . "/../vendor/autoload.php";

$loop = EventLoop::getLoop();
$router = new \Rxnet\Routing\Router();

// I'll get id and title as labels
$router->route("/articles/{id}/{title}", ['method'=>'get'])
->subscribeCallback(function (RoutableSubject $subject) use ($loop) {
$i = 0;
$loop->addPeriodicTimer(1, function(\React\EventLoop\Timer\Timer $timer) use(&$i, $subject) {
$i++;
echo ".";
$subject->onNext("Coucou {$i}");
if($i == 5 ) {
echo "#";
$timer->cancel();
$subject->onCompleted();
}
});
});
$router->route("/articles/{id}/{title}", ['method'=>'post'])
->subscribeCallback(function (RoutableSubject $subject) use ($loop) {
$subject->onNext("Coucou post");
$subject->onCompleted();
});
/*$router->route('/articles/{id:\d+}')
->subscribeCallback(function() {
//var_dump(func_get_args());
});
*/

$zmq = new \Rxnet\Zmq\RxZmq($loop);
$dealer = $zmq->dealer("tcp://127.0.0.1:8081");
$dealer->subscribe($router);

$httpd = new \Rxnet\Httpd\Httpd();
$httpd->map(new \Rxnet\Httpd\Strategies\StreamingResponseRouting())
->subscribe($router);

$httpd->listen(8080);


$loop->run();

//$router->onNext(new \Rxnet\Event\Event("/articles/233", 'coucou'));

//$router->onNext(new \Rxnet\Event\Event("/articles/238/superbe", 'ici'));
142 changes: 0 additions & 142 deletions examples/routing.php

This file was deleted.

15 changes: 0 additions & 15 deletions src/Rxnet/Contract/HasQueue.php

This file was deleted.

8 changes: 0 additions & 8 deletions src/Rxnet/Contract/HasValidation.php

This file was deleted.

11 changes: 0 additions & 11 deletions src/Rxnet/Routing/Contracts/AggregateRootInterface.php

This file was deleted.

10 changes: 0 additions & 10 deletions src/Rxnet/Routing/Contracts/PayloadInterface.php

This file was deleted.

10 changes: 0 additions & 10 deletions src/Rxnet/Routing/Contracts/RoutableInterface.php

This file was deleted.

51 changes: 0 additions & 51 deletions src/Rxnet/Routing/DataModel.php

This file was deleted.

41 changes: 0 additions & 41 deletions src/Rxnet/Routing/DataModelFactory.php

This file was deleted.

Loading

0 comments on commit 6834ce3

Please sign in to comment.