Skip to content

Commit 5cc8df6

Browse files
committed
Merge branch 'master' into bundle-use-null-transport-as-default
pkg/enqueue-bundle/Tests/Unit/DependencyInjection/EnqueueExtensionTest.php
2 parents 929fee2 + 1c6d2a9 commit 5cc8df6

File tree

61 files changed

+1645
-533
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1645
-533
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Change Log
22

3+
## [0.4.0](https://github.com/php-enqueue/enqueue-dev/tree/0.4.0) (2017-05-12)
4+
[Full Changelog](https://github.com/php-enqueue/enqueue-dev/compare/0.3.8...0.4.0)
5+
6+
- \[fs\] add DSN support [\#82](https://github.com/php-enqueue/enqueue-dev/pull/82) ([makasim](https://github.com/makasim))
7+
- \[amqp\] Configure by string DSN. [\#80](https://github.com/php-enqueue/enqueue-dev/pull/80) ([makasim](https://github.com/makasim))
8+
9+
- \[Extensions\] extensions priority [\#79](https://github.com/php-enqueue/enqueue-dev/issues/79)
10+
11+
- \[fs\] Filesystem transport must create a storage dir if it does not exists. [\#78](https://github.com/php-enqueue/enqueue-dev/pull/78) ([makasim](https://github.com/makasim))
12+
- \[magento\] Add basic docs for enqueue magento extension. [\#76](https://github.com/php-enqueue/enqueue-dev/pull/76) ([makasim](https://github.com/makasim))
13+
314
## [0.3.8](https://github.com/php-enqueue/enqueue-dev/tree/0.3.8) (2017-05-10)
415
[Full Changelog](https://github.com/php-enqueue/enqueue-dev/compare/0.3.7...0.3.8)
516

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ Features:
1818
- [Filesystem](docs/transport/filesystem.md)
1919
- [Null](docs/transport/null.md).
2020
* Generic purpose abstraction level (the transport level).
21-
* "Opinionated" easy to use abstraction level (the client level).
21+
* Easy to use abstraction level (the client level).
22+
* [Symfony bundle](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/bundle/quick_tour.md)
23+
* [Magento1 extension](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/magento/quick_tour.md)
2224
* [Message bus](http://www.enterpriseintegrationpatterns.com/patterns/messaging/MessageBus.html) support.
2325
* [RPC over MQ](https://www.rabbitmq.com/tutorials/tutorial-one-php.html) support.
2426
* Temporary queues support.
25-
* Well designed components (decoupled, reusable,).
26-
* Tested with unit and functional tests.
27+
* Well designed components decoupled and reusable.
28+
* Carefully tested including unit and functional tests.
2729
* For more visit [quick tour](docs/quick_tour.md).
2830

2931
## Resources
@@ -42,4 +44,4 @@ If you have any questions and inquires about our open source development, this p
4244

4345
## License
4446

45-
It is released under the [MIT License](LICENSE).
47+
It is released under the [MIT License](LICENSE).

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
"friendsofphp/php-cs-fixer": "^2",
2828
"empi89/php-amqp-stubs": "*@dev"
2929
},
30+
"autoload": {
31+
"files": ["pkg/enqueue/functions_include.php"]
32+
},
3033
"config": {
3134
"bin-dir": "bin"
3235
},

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ services:
1010
volumes:
1111
- './:/mqdev'
1212
environment:
13+
- AMQP_DSN=amqp://guest:guest@rabbitmq:5672/mqdev
1314
- SYMFONY__RABBITMQ__HOST=rabbitmq
1415
- SYMFONY__RABBITMQ__USER=guest
1516
- SYMFONY__RABBITMQ__PASSWORD=guest

docs/bundle/config_reference.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ enqueue:
4343
# Port on the host.
4444
port: 5672
4545

46-
# The login name to use. Note: Max 128 characters.
47-
login: guest
46+
# The user name to use. Note: Max 128 characters.
47+
user: guest
4848

4949
# Password. Note: Max 128 characters.
50-
password: guest
50+
pass: guest
5151

5252
# The virtual host on the host. Note: Max 128 characters.
5353
vhost: /
@@ -70,11 +70,11 @@ enqueue:
7070
# Port on the host.
7171
port: 5672
7272

73-
# The login name to use. Note: Max 128 characters.
74-
login: guest
73+
# The user name to use. Note: Max 128 characters.
74+
user: guest
7575

7676
# Password. Note: Max 128 characters.
77-
password: guest
77+
pass: guest
7878

7979
# The virtual host on the host. Note: Max 128 characters.
8080
vhost: /
@@ -95,7 +95,7 @@ enqueue:
9595
fs:
9696

9797
# The store directory where all queue\topics files will be created and messages are stored
98-
store_dir: ~ # Required
98+
path: ~ # Required
9999

100100
# The option tells how many messages should be read from file at once. The feature save resources but could lead to bigger messages lose.
101101
pre_fetch_count: 1

docs/bundle/quick_tour.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# EnqueueBundle. Quick tour.
22

3-
The bundle integrates enqueue library.
3+
The [EnqueueBundle](https://github.com/php-enqueue/enqueue-bundle) integrates enqueue library.
44
It adds easy to use [configuration layer](config_reference.md), register services, adds handy [cli commands](cli_commands.md).
55

66
## Install
@@ -45,13 +45,7 @@ First, you have to configure a transport layer and set one to be default.
4545

4646
enqueue:
4747
transport:
48-
default: 'amqp'
49-
amqp:
50-
host: 'localhost'
51-
port: 5672
52-
login: 'guest'
53-
password: 'guest'
54-
vhost: '/'
48+
default: "amqp://"
5549
client: ~
5650
```
5751

docs/client/quick_tour.md

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,7 @@ use Enqueue\SimpleClient\SimpleClient;
2222

2323
include __DIR__.'/vendor/autoload.php';
2424

25-
$client = new SimpleClient([
26-
'transport' => [
27-
'default' => 'amqp',
28-
'amqp' => [
29-
'host' => 'localhost',
30-
'port' => 5672,
31-
'vhost' => '/',
32-
'login' => 'guest',
33-
'password' => 'guest',
34-
],
35-
],
36-
'client' => [
37-
'app_name' => 'plain_php',
38-
],
39-
]);
25+
$client = new SimpleClient('amqp://');
4026
```
4127

4228
## Produce message

docs/client/rpc_call.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
# Client. RPC call
22

33
The client's [quick tour](quick_tour.md) describes how to get the client object.
4-
We use you followed instructions there and have instance of `Enqueue\SimpleClient\SimpleClient` in `$client` var.
4+
Here we'll use `Enqueue\SimpleClient\SimpleClient` though it is not required.
5+
You can get all that stuff from manually built client or get objects from a container (Symfony).
6+
7+
The simple client could be created like this:
58

69
## The client side
710

811
There is a handy class RpcClient shipped with the client component.
9-
It allows you to easily send a message and wait for a reply.
12+
It allows you to easily perform [RPC calls](https://en.wikipedia.org/wiki/Remote_procedure_call).
13+
It send a message and wait for a reply.
1014

1115
```php
1216
<?php
1317
use Enqueue\Client\RpcClient;
18+
use Enqueue\SimpleClient\SimpleClient;
1419

15-
/** @var \Enqueue\SimpleClient\SimpleClient $client */
20+
$client = new SimpleClient('amqp://');
1621

1722
$rpcClient = new RpcClient($client->getProducer(), $context);
1823

@@ -24,8 +29,9 @@ You can perform several requests asynchronously with `callAsync` and request rep
2429
```php
2530
<?php
2631
use Enqueue\Client\RpcClient;
32+
use Enqueue\SimpleClient\SimpleClient;
2733

28-
/** @var \Enqueue\SimpleClient\SimpleClient $client */
34+
$client = new SimpleClient('amqp://');
2935

3036
$rpcClient = new RpcClient($client->getProducer(), $context);
3137

@@ -54,10 +60,11 @@ use Enqueue\Psr\PsrContext;
5460
use Enqueue\Consumption\Result;
5561
use Enqueue\Consumption\ChainExtension;
5662
use Enqueue\Consumption\Extension\ReplyExtension;
63+
use Enqueue\SimpleClient\SimpleClient;
5764

5865
/** @var \Enqueue\Psr\PsrContext $context */
5966

60-
/** @var \Enqueue\SimpleClient\SimpleClient $client */
67+
$client = new SimpleClient('amqp://');
6168

6269
$client->bind('greeting_topic', 'greeting_processor', function (PsrMessage $message, PsrContext $context) use (&$requestMessage) {
6370
echo $message->getBody();

docs/quick_tour.md

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -170,19 +170,11 @@ Here's an example of how you can send and consume messages.
170170
use Enqueue\SimpleClient\SimpleClient;
171171
use Enqueue\Psr\PsrMessage;
172172

173-
$client = new SimpleClient([
174-
'transport' => [
175-
'default' => 'amqp',
176-
'amqp' => [
177-
'host' => 'localhost',
178-
'port' => 5672,
179-
'vhost' => '/',
180-
'login' => 'guest',
181-
'password' => 'guest',
182-
],
183-
],
184-
'client' => true,
185-
]);
173+
// composer require enqueue/amqp-ext
174+
$client = new SimpleClient('amqp://');
175+
176+
// composer require enqueue/fs
177+
$client = new SimpleClient('file://foo/bar');
186178

187179
$client->setupBroker();
188180

docs/transport/amqp.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,28 @@ $ composer require enqueue/amqp-ext
2525
<?php
2626
use Enqueue\AmqpExt\AmqpConnectionFactory;
2727

28+
// connects to localhost
29+
$connectionFactory = new AmqpConnectionFactory();
30+
31+
// same as above
32+
$connectionFactory = new AmqpConnectionFactory('amqp://');
33+
34+
// same as above
35+
$connectionFactory = new AmqpConnectionFactory([]);
36+
37+
// connect to AMQP broker at example.com
2838
$connectionFactory = new AmqpConnectionFactory([
29-
'host' => '127.0.0.1',
30-
'port' => 5672,
39+
'host' => 'example.com',
40+
'port' => 1000,
3141
'vhost' => '/',
32-
'login' => 'guest',
33-
'password' => 'guest',
42+
'user' => 'user',
43+
'pass' => 'pass',
3444
'persisted' => false,
3545
]);
3646

47+
// same as above but given as DSN string
48+
$connectionFactory = new AmqpConnectionFactory('amqp://user:[email protected]:10000/%2f');
49+
3750
$psrContext = $connectionFactory->createContext();
3851
```
3952

0 commit comments

Comments
 (0)