Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2596b85

Browse files
committed
Merge branch 'master' into pr-354
pkg/enqueue-bundle/Tests/Unit/DependencyInjection/EnqueueExtensionTest.php
2 parents e08f8a3 + 28a5903 commit 2596b85

Some content is hidden

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

48 files changed

+1135
-181
lines changed

CHANGELOG.md

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

3+
## [0.8.20](https://github.com/php-enqueue/enqueue-dev/tree/0.8.20) (2018-02-15)
4+
[Full Changelog](https://github.com/php-enqueue/enqueue-dev/compare/0.8.19...0.8.20)
5+
6+
- \[Redis\] Add ability to pass Redis instance to connection factory [\#372](https://github.com/php-enqueue/enqueue-dev/pull/372) ([makasim](https://github.com/makasim))
7+
8+
- Pass options to predis client when using redis transport [\#367](https://github.com/php-enqueue/enqueue-dev/issues/367)
9+
- Authentication Support for Redis [\#349](https://github.com/php-enqueue/enqueue-dev/issues/349)
10+
- Does redis factory supports sentinel or cluster? [\#341](https://github.com/php-enqueue/enqueue-dev/issues/341)
11+
12+
## [0.8.19](https://github.com/php-enqueue/enqueue-dev/tree/0.8.19) (2018-02-14)
13+
[Full Changelog](https://github.com/php-enqueue/enqueue-dev/compare/0.8.18...0.8.19)
14+
15+
- \[Docs\] Describe difference between command and event messages [\#351](https://github.com/php-enqueue/enqueue-dev/issues/351)
16+
- Fix typo [\#369](https://github.com/php-enqueue/enqueue-dev/pull/369) ([kubk](https://github.com/kubk))
17+
- \[client\]\[skip ci\] Explain meaning of sendEvent, sendCommand methods. [\#365](https://github.com/php-enqueue/enqueue-dev/pull/365) ([makasim](https://github.com/makasim))
18+
- Modify async\_events.md grammar [\#364](https://github.com/php-enqueue/enqueue-dev/pull/364) ([ddproxy](https://github.com/ddproxy))
19+
20+
- Fix wrong argument type [\#361](https://github.com/php-enqueue/enqueue-dev/pull/361) ([olix21](https://github.com/olix21))
21+
22+
- Minor grammatical changes to documentation [\#363](https://github.com/php-enqueue/enqueue-dev/issues/363)
23+
- \[DbalConsumer\] Issue with id type [\#360](https://github.com/php-enqueue/enqueue-dev/issues/360)
24+
25+
- \[dbal\] Sort priority messages by published at date too. [\#371](https://github.com/php-enqueue/enqueue-dev/pull/371) ([makasim](https://github.com/makasim))
26+
27+
## [0.8.18](https://github.com/php-enqueue/enqueue-dev/tree/0.8.18) (2018-02-07)
28+
[Full Changelog](https://github.com/php-enqueue/enqueue-dev/compare/0.8.17...0.8.18)
29+
30+
- \[SQS\] Allow custom aws endpoint configuration [\#352](https://github.com/php-enqueue/enqueue-dev/issues/352)
31+
- Added endpoint configuration and updated the tests [\#353](https://github.com/php-enqueue/enqueue-dev/pull/353) ([gitis](https://github.com/gitis))
32+
33+
- Transport is not enabled: amqp: [\#356](https://github.com/php-enqueue/enqueue-dev/issues/356)
34+
- \[bundle\] DefaultTransportFactory should accept DSN like foo: [\#358](https://github.com/php-enqueue/enqueue-dev/pull/358) ([makasim](https://github.com/makasim))
35+
- \[dbal\] Consumer never fetches messages ordered by published time [\#343](https://github.com/php-enqueue/enqueue-dev/pull/343) ([f7h](https://github.com/f7h))
36+
37+
- \[SQS\] Unable to connect to FIFO queue [\#342](https://github.com/php-enqueue/enqueue-dev/issues/342)
38+
- \[dbal\] Consumer never fetches messages ordered by published time [\#340](https://github.com/php-enqueue/enqueue-dev/issues/340)
39+
40+
- Moved symfony/framework-bundle to require-dev [\#348](https://github.com/php-enqueue/enqueue-dev/pull/348) ([prisis](https://github.com/prisis))
41+
- Gearman PHP 7 support [\#347](https://github.com/php-enqueue/enqueue-dev/pull/347) ([Jawshua](https://github.com/Jawshua))
42+
43+
## [0.8.17](https://github.com/php-enqueue/enqueue-dev/tree/0.8.17) (2018-01-18)
44+
[Full Changelog](https://github.com/php-enqueue/enqueue-dev/compare/0.8.16...0.8.17)
45+
46+
- QueueConsumer should be final [\#311](https://github.com/php-enqueue/enqueue-dev/issues/311)
47+
- \[consumption\] Make QueueConsumer final [\#336](https://github.com/php-enqueue/enqueue-dev/pull/336) ([makasim](https://github.com/makasim))
48+
- \[bundle\]\[dx\] Add a message that suggest installing a pkg to use the transport. [\#335](https://github.com/php-enqueue/enqueue-dev/pull/335) ([makasim](https://github.com/makasim))
49+
- \[0.9\]\[BC break\]\[dbal\] Store UUIDs as binary data. Improves performance [\#280](https://github.com/php-enqueue/enqueue-dev/pull/280) ([makasim](https://github.com/makasim))
50+
51+
- Unrecognized option "amqp" under "enqueue.transport" [\#333](https://github.com/php-enqueue/enqueue-dev/issues/333)
52+
53+
- \[consumption\] Prepare QueueConsumer for changes in 0.9 [\#337](https://github.com/php-enqueue/enqueue-dev/pull/337) ([makasim](https://github.com/makasim))
54+
55+
## [0.8.16](https://github.com/php-enqueue/enqueue-dev/tree/0.8.16) (2018-01-13)
56+
[Full Changelog](https://github.com/php-enqueue/enqueue-dev/compare/0.8.15...0.8.16)
57+
58+
- \[Sqs\] Allow array-based DSN configuration [\#315](https://github.com/php-enqueue/enqueue-dev/pull/315) ([beryllium](https://github.com/beryllium))
59+
60+
## [0.8.15](https://github.com/php-enqueue/enqueue-dev/tree/0.8.15) (2018-01-12)
61+
[Full Changelog](https://github.com/php-enqueue/enqueue-dev/compare/0.8.14...0.8.15)
62+
63+
- \[consumption\] Correct message in LoggerExtension [\#322](https://github.com/php-enqueue/enqueue-dev/pull/322) ([makasim](https://github.com/makasim))
64+
65+
- \[amqp\] fix signal handler if consume called from consume [\#328](https://github.com/php-enqueue/enqueue-dev/pull/328) ([makasim](https://github.com/makasim))
66+
67+
- SQS via DNS region missing [\#321](https://github.com/php-enqueue/enqueue-dev/issues/321)
68+
69+
- Update config\_reference.md [\#326](https://github.com/php-enqueue/enqueue-dev/pull/326) ([errogaht](https://github.com/errogaht))
70+
- Update message\_producer.md [\#325](https://github.com/php-enqueue/enqueue-dev/pull/325) ([errogaht](https://github.com/errogaht))
71+
- Update consumption\_extension.md [\#324](https://github.com/php-enqueue/enqueue-dev/pull/324) ([errogaht](https://github.com/errogaht))
72+
73+
## [0.8.14](https://github.com/php-enqueue/enqueue-dev/tree/0.8.14) (2018-01-10)
74+
[Full Changelog](https://github.com/php-enqueue/enqueue-dev/compare/0.8.13...0.8.14)
75+
76+
## [0.8.13](https://github.com/php-enqueue/enqueue-dev/tree/0.8.13) (2018-01-09)
77+
[Full Changelog](https://github.com/php-enqueue/enqueue-dev/compare/0.8.12...0.8.13)
78+
79+
- \[amqp\] Fix socket and signal issue. [\#317](https://github.com/php-enqueue/enqueue-dev/pull/317) ([makasim](https://github.com/makasim))
80+
- \[kafka\] add ability to set offset. [\#314](https://github.com/php-enqueue/enqueue-dev/pull/314) ([makasim](https://github.com/makasim))
81+
82+
- AMQPIOWaitException upon docker container shutdown [\#300](https://github.com/php-enqueue/enqueue-dev/issues/300)
83+
384
## [0.8.12](https://github.com/php-enqueue/enqueue-dev/tree/0.8.12) (2018-01-04)
485
[Full Changelog](https://github.com/php-enqueue/enqueue-dev/compare/0.8.11...0.8.12)
586

bin/dev

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ set -e
66
while getopts "bustefcdp" OPTION; do
77
case $OPTION in
88
b)
9-
COMPOSE_PROJECT_NAME=mqdev docker-compose pull && COMPOSE_PROJECT_NAME=mqdev docker-compose build
9+
docker-compose pull && docker-compose build
1010
;;
1111
u)
12-
COMPOSE_PROJECT_NAME=mqdev docker-compose up
12+
docker-compose up
1313
;;
1414
s)
15-
COMPOSE_PROJECT_NAME=mqdev docker-compose stop
15+
docker-compose stop
1616
;;
1717
e)
1818
docker exec -it mqdev_dev_1 /bin/bash
@@ -24,10 +24,10 @@ while getopts "bustefcdp" OPTION; do
2424
./bin/run-fun-test.sh "$2"
2525
;;
2626
c)
27-
COMPOSE_PROJECT_NAME=mqdev docker-compose run -e CHANGELOG_GITHUB_TOKEN=${CHANGELOG_GITHUB_TOKEN:-""} --workdir="/mqdev" --rm generate-changelog github_changelog_generator --future-release "$2" --simple-list
27+
docker-compose run -e CHANGELOG_GITHUB_TOKEN=${CHANGELOG_GITHUB_TOKEN:-""} --workdir="/mqdev" --rm generate-changelog github_changelog_generator --future-release "$2" --simple-list
2828
;;
2929

30-
d) COMPOSE_PROJECT_NAME=mqdev docker-compose run --workdir="/mqdev" --rm dev php pkg/enqueue-bundle/Tests/Functional/app/console.php config:dump-reference enqueue -vvv
30+
d) docker-compose run --workdir="/mqdev" --rm dev php pkg/enqueue-bundle/Tests/Functional/app/console.php config:dump-reference enqueue -vvv
3131
;;
3232
\?)
3333
echo "Invalid option: -$OPTARG" >&2

docs/bundle/async_events.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,24 @@ The consumer, once it receives the message, restores the event and dispatches it
77

88
Async listeners benefits:
99

10-
* The response time lesser. It has to do less work.
11-
* Better fault tolerance. Bugs in async listener does not affect user. Messages will wait till you fix bugs.
10+
* Reduces response time. Work is deferred to consumer processes.
11+
* Better fault tolerance. Bugs in async listener do not affect user. Messages will wait till you fix bugs.
1212
* Better scaling. Add more consumers to meet the load.
1313

14-
_**Note**: The php serializer transformer (the default one) does not work on Symfony prior 3.0. The event contains eventDispatcher and therefor could not be serialized. You have to register a transformer for every async event. Read the [event transformer](#event-transformer)._
14+
_**Note**: Prior to Symfony 3.0, events contain `eventDispatcher` and the default php serializer transformer is unable to serialize the object. A transformer should be registered for every async event. Read the [event transformer](#event-transformer)._
1515

1616
## Configuration
1717

18-
I suppose you already [installed the bundle](quick_tour.md#install).
19-
Now, you have to enable `async_events`.
20-
If you do not enable it, events will be processed as before: synchronously.
18+
Symfony events are currently processed synchronously, enabling the async configuration for EnqueueBundle causes tagged listeners to defer action to a consumer asynchronously.
19+
If you already [installed the bundle](quick_tour.md#install), then enable `async_events`.
2120

2221
```yaml
2322
# app/config/config.yml
2423

2524
enqueue:
2625
async_events:
2726
enabled: true
28-
# if you'd like to send send messages onTerminate use spool_producer (it makes response time even lesser):
27+
# if you'd like to send send messages onTerminate use spool_producer (it further reduces response time):
2928
# spool_producer: true
3029
```
3130

@@ -77,7 +76,7 @@ services:
7776
## Event transformer
7877

7978
The bundle uses [php serializer](https://github.com/php-enqueue/enqueue-dev/blob/master/pkg/enqueue-bundle/Events/PhpSerializerEventTransformer.php) transformer by default to pass events through MQ.
80-
You could create a transformer for the given event type. The transformer must implement `Enqueue\AsyncEventDispatcher\EventTransformer` interface.
79+
You can write a transformer for each event type by implementing the `Enqueue\AsyncEventDispatcher\EventTransformer` interface.
8180
Consider the next example. It shows how to send an event that contains Doctrine entity as a subject
8281

8382
```php
@@ -165,4 +164,4 @@ services:
165164
The `eventName` attribute accepts a regexp. You can do next `eventName: '/foo\..*?/'`.
166165
It uses this transformer for all event with the name beginning with `foo.`
167166

168-
[back to index](../index.md)
167+
[back to index](../index.md)

docs/bundle/config_reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ enqueue:
251251
app_name: app
252252
router_topic: default
253253
router_queue: default
254-
router_processor: enqueue.client.router_processor
254+
router_processor: Enqueue\Client\RouterProcessor
255255
default_processor_queue: default
256256
redelivered_delay_time: 0
257257
consumption:

docs/bundle/consumption_extension.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Consumption extension
22

3-
Here, I show how you can crate a custom extension and register it.
3+
Here, I show how you can create a custom extension and register it.
44
Let's first create an extension itself:
55

66
```php
@@ -38,4 +38,4 @@ services:
3838
- { name: 'enqueue.consumption.extension', priority: 10 }
3939
```
4040
41-
[back to index](../index.md)
41+
[back to index](../index.md)

docs/bundle/debuging.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ Here's the result:
6363

6464
## Consume command verbosity
6565

66-
By default the commands `enqueu:conume` or `enqueue:transport:consume` does not output anything.
66+
By default the commands `enqueue:consume` or `enqueue:transport:consume` does not output anything.
6767
You can add `-vvv` to see more information.
6868

6969
![Consume command verbosity](../images/consume_command_verbosity.png)
7070

71-
[back to index](../index.md)
71+
[back to index](../index.md)

docs/bundle/message_producer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ where another one (it is called spool producer) collects them in memory and send
2626

2727
The producer has two types on send methods:
2828

29-
* `sendEvent` - Message is sent to topic and many consumers can subscriber to it. It is "fire and forget" strategy. The even could be sent to "message bus" to other applications.
29+
* `sendEvent` - Message is sent to topic and many consumers can subscriber to it. It is "fire and forget" strategy. The event could be sent to "message bus" to other applications.
3030
* `sendCommand` - Message is to ONE exact consumer. It could be used as "fire and forget" or as RPC. The command message is always sent in scope of current application.
3131

3232
### Send event

docs/client/quick_tour.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ $ composer require enqueue/simple-client enqueue/amqp-ext
1616

1717
## Configure
1818

19+
The code below shows how to use simple client with AMQP transport. There are other [supported brokers](supported_brokers.md).
20+
1921
```php
2022
<?php
2123
use Enqueue\SimpleClient\SimpleClient;
@@ -27,25 +29,56 @@ $client = new SimpleClient('amqp:');
2729

2830
## Produce message
2931

32+
There two types of message a client can produce: events and commands.
33+
Events are used to notify others about something, in other words it is an implementation of [publish-subscribe pattern](https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern), sometimes called "fire-and-forget" too.
34+
With events there is no way to get a reply as a producer is not aware of any subscribed consumers.
35+
Commands are used to request a job to be done. It is an implementation of one-to-one messaging pattern.
36+
A producer can request a reply from the consumer though it is up to the consumer whether send it or not.
37+
38+
Commands work inside the app [scope](message_examples.md#scope) where events work inside the app scope as well as on [message bus](message_bus.md) scope.
39+
40+
Send event examples:
41+
3042
```php
3143
<?php
3244

3345
/** @var \Enqueue\SimpleClient\SimpleClient $client */
3446

35-
$client->send('a_bar_topic', 'aMessageData');
47+
$client->setupBroker();
48+
49+
$client->sendEvent('user_updated', 'aMessageData');
3650

3751
// or an array
3852

39-
$client->send('a_bar_topic', ['foo', 'bar']);
53+
$client->sendEvent('order_price_calculated', ['foo', 'bar']);
4054

4155
// or an json serializable object
42-
$client->send('a_bar_topic', new class() implements \JsonSerializable {
56+
$client->sendEvent('user_activated', new class() implements \JsonSerializable {
4357
public function jsonSerialize() {
4458
return ['foo', 'bar'];
4559
}
4660
});
4761
```
4862

63+
Send command examples:
64+
65+
```php
66+
<?php
67+
68+
/** @var \Enqueue\SimpleClient\SimpleClient $client */
69+
70+
$client->setupBroker();
71+
72+
// accepts same type of arguments as sendEvent method
73+
$client->sendCommand('calculate_statistics', 'aMessageData');
74+
75+
$reply = $client->sendCommand('build_category_tree', 'aMessageData', true);
76+
77+
$replyMessage = $reply->receive(5000); // wait for reply for 5 seconds
78+
79+
$replyMessage->getBody();
80+
```
81+
4982
## Consume messages
5083

5184
```php

docs/client/supported_brokers.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Client. Supported brokers
22

3+
Here's the list of transports supported by Enqueue Client:
4+
5+
| Transport | Package | DSN |
6+
|:-------------------:|:----------------------------------------------------------:|:-------------------------------:|
7+
| AMQP, RabbitMQ | [enqueue/amqp-bunny](../transport/amqp_bunny.md) | amqp: amqp+bunny: |
8+
| AMQP, RabbitMQ | [enqueue/amqp-lib](../transport/amqp_lib.md) | amqp: amqp+lib: |
9+
| AMQP, RabbitMQ | [enqueue/amqp-ext](../transport/amqp.md) | amqp: amqp+ext: |
10+
| Doctrine DBAL | [enqueue/dbal](../transport/dbal.md) | mysql: pgsql: pdo_pgsql etc |
11+
| Filesystem | [enqueue/fs](../transport/fs.md) | file:///foo/bar |
12+
| Google PubSub | [enqueue/gps](../transport/gps.md) | gps: |
13+
| Redis | [enqueue/gps](../transport/redis.md) | redis: |
14+
| Amazon SQS | [enqueue/sqs](../transport/sqs.md) | sqs: |
15+
| STOMP, RabbitMQ | [enqueue/stomp](../transport/stomp.md) | stomp: |
16+
| Null | [enqueue/null](../transport/null.md) | null: |
17+
318
Here's the list of protocols and Client features supported by them
419

520
| Protocol | Priority | Delay | Expiration | Setup broker | Message bus |
@@ -11,7 +26,8 @@ Here's the list of protocols and Client features supported by them
1126
| Filesystem | No | No | No | Yes | No |
1227
| Redis | No | No | No | Not needed | No |
1328
| Doctrine DBAL | Yes | Yes | No | Yes | No |
14-
| AWS SQS | No | Yes | No | Yes | Not impl |
29+
| Amazon SQS | No | Yes | No | Yes | Not impl |
30+
| Google PubSub | Not impl | Not impl | Not impl | Yes | Not impl |
1531

1632
* \* Possible if a RabbitMQ delay plugin is installed.
1733
* \*\* Possible if topics (exchanges) are configured on broker side manually.

docs/quick_tour.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ $replyMessage = $promise->receive(2000); // 2 sec
233233
$client->consume([new ReplyExtension()]);
234234
```
235235

236+
Read more about events and commands [here](client/quick_tour.md#produce-message).
237+
236238
## Cli commands
237239

238240
The library provides handy commands out of the box.

docs/transport/redis.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,23 @@ $connectionFactory = new RedisConnectionFactory([
7878
$psrContext = $connectionFactory->createContext();
7979
```
8080

81+
* With custom redis instance:
82+
83+
It gives you more control over vendor specific features.
84+
85+
```php
86+
<?php
87+
use Enqueue\Redis\RedisConnectionFactory;
88+
use Enqueue\Redis\PRedis;
89+
90+
$config = [];
91+
$options = [];
92+
93+
$redis = new PRedis(new \PRedis\Client($config, $options));
94+
95+
$factory = new RedisConnectionFactory(['vendor' => 'custom', 'redis' => $redis]);
96+
```
97+
8198
## Send message to topic
8299

83100
```php

0 commit comments

Comments
 (0)