Created
April 23, 2015 18:38
-
-
Save jakubkulhan/f36776e9e112a423b8ba to your computer and use it in GitHub Desktop.
BunnyPHP Async Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace Bunny\Example; | |
| use Bunny\Async\Client; | |
| use Bunny\Channel; | |
| use React\EventLoop\Factory; | |
| $loop = Factory::create(); | |
| $c = new Client($loop, [ | |
| "host" => "127.0.0.1", | |
| "port" => 5672, | |
| "user" => "guest", | |
| "password" => "guest", | |
| "vhost" => "/", | |
| ]); | |
| $c->connect()->then(function (Client $c) { | |
| return $c->channel(); | |
| })->then(function (Channel $ch) { | |
| // ... work channel ... | |
| // $ch->exchangeDeclare(...) | |
| // $ch->publish(...) | |
| }); | |
| $loop->run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment