Skip to content

Commit 56e459c

Browse files
committed
Merge branch 'master' into 0.8
2 parents 3bea096 + 02fca65 commit 56e459c

File tree

253 files changed

+7709
-621
lines changed

Some content is hidden

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

253 files changed

+7709
-621
lines changed

.travis.yml

+5-6
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,16 @@ language: php
77

88
matrix:
99
include:
10-
- php: 5.6
11-
env: SYMFONY_VERSION=2.8.* UNIT_TESTS=true
1210
- php: 7.1
1311
env: SYMFONY_VERSION=3.0.* PHPSTAN=true
1412
- php: 7.1
1513
env: SYMFONY_VERSION=3.0.* PHP_CS_FIXER=true
1614
- php: 7.0
1715
env: SYMFONY_VERSION=2.8.* UNIT_TESTS=true
18-
- php: 5.6
19-
env: SYMFONY_VERSION=3.0.* UNIT_TESTS=true
2016
- php: 7.0
2117
env: SYMFONY_VERSION=3.0.* UNIT_TESTS=true
2218
- php: 7.1
23-
env: SYMFONY_VERSION=v4.0.0-BETA4 UNIT_TESTS=true
19+
env: SYMFONY_VERSION=4.0.* UNIT_TESTS=true
2420
- php: 7.1
2521
env: SYMFONY_VERSION=3.4.* UNIT_TESTS=true
2622
- php: 7.2
@@ -37,7 +33,7 @@ matrix:
3733
env: SYMFONY_VERSION=3.3.* FUNCTIONAL_TESTS=true PREPARE_CONTAINER=true
3834
- php: 7.1
3935
services: docker
40-
env: SYMFONY_VERSION=v4.0.0-BETA4 FUNCTIONAL_TESTS=true PREPARE_CONTAINER=true
36+
env: SYMFONY_VERSION=4.0.* FUNCTIONAL_TESTS=true PREPARE_CONTAINER=true
4137
- php: 7.1
4238
services: docker
4339
env: SYMFONY_VERSION=3.3.* RDKAFKA_TESTS=true PREPARE_CONTAINER=true
@@ -48,6 +44,9 @@ cache:
4844
directories:
4945
- $HOME/.composer/cache
5046

47+
before_install:
48+
- echo "extension = mongodb.so" >> $HOME/.phpenv/versions/$(phpenv version-name)/etc/php.ini
49+
5150
install:
5251
- rm $HOME/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini;
5352
- echo "memory_limit=2048M" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini

CHANGELOG.md

+243
Large diffs are not rendered by default.

README.md

+19-13
Original file line numberDiff line numberDiff line change
@@ -15,58 +15,64 @@ Features:
1515
* Supported transports
1616
* [AMQP(s)](docs/transport/amqp.md) based on [PHP AMQP extension](https://github.com/pdezwart/php-amqp).
1717
[![Build Status](https://travis-ci.org/php-enqueue/amqp-ext.png?branch=master)](https://travis-ci.org/php-enqueue/amqp-ext)
18-
[![Total Downloads](https://poser.pugx.org/enqueue/amqp-ext/d/total.png)](https://packagist.org/packages/enqueue/amqp-ext)
18+
[![Total Downloads](https://poser.pugx.org/enqueue/amqp-ext/d/total.png)](https://packagist.org/packages/enqueue/amqp-ext/stats)
1919
[![Latest Stable Version](https://poser.pugx.org/enqueue/amqp-ext/version.png)](https://packagist.org/packages/enqueue/amqp-ext)
2020
* [AMQP](docs/transport/amqp_bunny.md) based on [bunny](https://github.com/jakubkulhan/bunny).
2121
[![Build Status](https://travis-ci.org/php-enqueue/amqp-bunny.png?branch=master)](https://travis-ci.org/php-enqueue/amqp-bunny)
22-
[![Total Downloads](https://poser.pugx.org/enqueue/amqp-bunny/d/total.png)](https://packagist.org/packages/enqueue/amqp-bunny)
22+
[![Total Downloads](https://poser.pugx.org/enqueue/amqp-bunny/d/total.png)](https://packagist.org/packages/enqueue/amqp-bunny/stats)
2323
[![Latest Stable Version](https://poser.pugx.org/enqueue/amqp-bunny/version.png)](https://packagist.org/packages/enqueue/amqp-bunny)
2424
* [AMQP(s)](docs/transport/amqp_lib.md) based on [php-amqplib](https://github.com/php-amqplib/php-amqplib).
2525
[![Build Status](https://travis-ci.org/php-enqueue/amqp-lib.png?branch=master)](https://travis-ci.org/php-enqueue/amqp-lib)
26-
[![Total Downloads](https://poser.pugx.org/enqueue/amqp-lib/d/total.png)](https://packagist.org/packages/enqueue/amqp-lib)
26+
[![Total Downloads](https://poser.pugx.org/enqueue/amqp-lib/d/total.png)](https://packagist.org/packages/enqueue/amqp-lib/stats)
2727
[![Latest Stable Version](https://poser.pugx.org/enqueue/amqp-lib/version.png)](https://packagist.org/packages/enqueue/amqp-lib)
2828
* [Beanstalk](docs/transport/pheanstalk.md).
2929
[![Build Status](https://travis-ci.org/php-enqueue/pheanstalk.png?branch=master)](https://travis-ci.org/php-enqueue/pheanstalk)
30-
[![Total Downloads](https://poser.pugx.org/enqueue/pheanstalk/d/total.png)](https://packagist.org/packages/enqueue/pheanstalk)
30+
[![Total Downloads](https://poser.pugx.org/enqueue/pheanstalk/d/total.png)](https://packagist.org/packages/enqueue/pheanstalk/stats)
3131
[![Latest Stable Version](https://poser.pugx.org/enqueue/pheanstalk/version.png)](https://packagist.org/packages/enqueue/pheanstalk)
3232
* [STOMP](docs/transport/stomp.md)
3333
[![Build Status](https://travis-ci.org/php-enqueue/stomp.png?branch=master)](https://travis-ci.org/php-enqueue/stomp)
34-
[![Total Downloads](https://poser.pugx.org/enqueue/stomp/d/total.png)](https://packagist.org/packages/enqueue/stomp)
34+
[![Total Downloads](https://poser.pugx.org/enqueue/stomp/d/total.png)](https://packagist.org/packages/enqueue/stomp/stats)
3535
[![Latest Stable Version](https://poser.pugx.org/enqueue/stomp/version.png)](https://packagist.org/packages/enqueue/stomp)
3636
* [Amazon SQS](docs/transport/sqs.md)
3737
[![Build Status](https://travis-ci.org/php-enqueue/sqs.png?branch=master)](https://travis-ci.org/php-enqueue/sqs)
38-
[![Total Downloads](https://poser.pugx.org/enqueue/sqs/d/total.png)](https://packagist.org/packages/enqueue/sqs)
38+
[![Total Downloads](https://poser.pugx.org/enqueue/sqs/d/total.png)](https://packagist.org/packages/enqueue/sqs/stats)
3939
[![Latest Stable Version](https://poser.pugx.org/enqueue/sqs/version.png)](https://packagist.org/packages/enqueue/sqs)
4040
* [Google PubSub](docs/transport/gps.md)
4141
[![Build Status](https://travis-ci.org/php-enqueue/gps.png?branch=master)](https://travis-ci.org/php-enqueue/gps)
42-
[![Total Downloads](https://poser.pugx.org/enqueue/gps/d/total.png)](https://packagist.org/packages/enqueue/gps)
42+
[![Total Downloads](https://poser.pugx.org/enqueue/gps/d/total.png)](https://packagist.org/packages/enqueue/gps/stats)
4343
[![Latest Stable Version](https://poser.pugx.org/enqueue/gps/version.png)](https://packagist.org/packages/enqueue/gps)
4444
* [Kafka](docs/transport/kafka.md)
4545
[![Build Status](https://travis-ci.org/php-enqueue/rdkafka.png?branch=master)](https://travis-ci.org/php-enqueue/rdkafka)
46-
[![Total Downloads](https://poser.pugx.org/enqueue/rdkafka/d/total.png)](https://packagist.org/packages/enqueue/rdkafka)
46+
[![Total Downloads](https://poser.pugx.org/enqueue/rdkafka/d/total.png)](https://packagist.org/packages/enqueue/rdkafka/stats)
4747
[![Latest Stable Version](https://poser.pugx.org/enqueue/rdkafka/version.png)](https://packagist.org/packages/enqueue/rdkafka)
4848
* [Redis](docs/transport/redis.md)
4949
[![Build Status](https://travis-ci.org/php-enqueue/redis.png?branch=master)](https://travis-ci.org/php-enqueue/redis)
50-
[![Total Downloads](https://poser.pugx.org/enqueue/redis/d/total.png)](https://packagist.org/packages/enqueue/redis)
50+
[![Total Downloads](https://poser.pugx.org/enqueue/redis/d/total.png)](https://packagist.org/packages/enqueue/redis/stats)
5151
[![Latest Stable Version](https://poser.pugx.org/enqueue/redis/version.png)](https://packagist.org/packages/enqueue/redis)
5252
* [Gearman](docs/transport/gearman.md)
5353
[![Build Status](https://travis-ci.org/php-enqueue/gearman.png?branch=master)](https://travis-ci.org/php-enqueue/gearman)
54-
[![Total Downloads](https://poser.pugx.org/enqueue/gearman/d/total.png)](https://packagist.org/packages/enqueue/gearman)
54+
[![Total Downloads](https://poser.pugx.org/enqueue/gearman/d/total.png)](https://packagist.org/packages/enqueue/gearman/stats)
5555
[![Latest Stable Version](https://poser.pugx.org/enqueue/gearman/version.png)](https://packagist.org/packages/enqueue/gearman)
5656
* [Doctrine DBAL](docs/transport/dbal.md)
5757
[![Build Status](https://travis-ci.org/php-enqueue/dbal.png?branch=master)](https://travis-ci.org/php-enqueue/dbal)
58-
[![Total Downloads](https://poser.pugx.org/enqueue/dbal/d/total.png)](https://packagist.org/packages/enqueue/dbal)
58+
[![Total Downloads](https://poser.pugx.org/enqueue/dbal/d/total.png)](https://packagist.org/packages/enqueue/dbal/stats)
5959
[![Latest Stable Version](https://poser.pugx.org/enqueue/dbal/version.png)](https://packagist.org/packages/enqueue/dbal)
6060
* [Filesystem](docs/transport/filesystem.md)
6161
[![Build Status](https://travis-ci.org/php-enqueue/fs.png?branch=master)](https://travis-ci.org/php-enqueue/fs)
62-
[![Total Downloads](https://poser.pugx.org/enqueue/fs/d/total.png)](https://packagist.org/packages/enqueue/fs)
62+
[![Total Downloads](https://poser.pugx.org/enqueue/fs/d/total.png)](https://packagist.org/packages/enqueue/fs/stats)
6363
[![Latest Stable Version](https://poser.pugx.org/enqueue/fs/version.png)](https://packagist.org/packages/enqueue/fs)
64+
* [Mongodb](docs/transport/mongodb.md)
65+
[![Build Status](https://travis-ci.org/php-enqueue/mongodb.png?branch=master)](https://travis-ci.org/php-enqueue/mongodb)
66+
[![Total Downloads](https://poser.pugx.org/enqueue/mongodb/d/total.png)](https://packagist.org/packages/enqueue/mongodb/stats)
67+
[![Latest Stable Version](https://poser.pugx.org/enqueue/mongodb/version.png)](https://packagist.org/packages/enqueue/mongodb)
6468
* [Null](docs/transport/null.md).
6569
[![Build Status](https://travis-ci.org/php-enqueue/null.png?branch=master)](https://travis-ci.org/php-enqueue/null)
66-
[![Total Downloads](https://poser.pugx.org/enqueue/null/d/total.png)](https://packagist.org/packages/enqueue/null)
70+
[![Total Downloads](https://poser.pugx.org/enqueue/null/d/total.png)](https://packagist.org/packages/enqueue/null/stats)
6771
[![Latest Stable Version](https://poser.pugx.org/enqueue/null/version.png)](https://packagist.org/packages/enqueue/null)
72+
* [the others are comming](https://github.com/php-enqueue/enqueue-dev/issues/284)
6873
* [Symfony bundle](docs/bundle/quick_tour.md)
6974
* [Magento1 extension](docs/magento/quick_tour.md)
75+
* [Magento2 module](docs/magento2/quick_tour.md)
7076
* [Laravel extension](docs/laravel/quick_tour.md)
7177
* [Yii2. Amqp driver](docs/yii/amqp_driver.md)
7278
* [Message bus](docs/quick_tour.md#client) support.

bin/dev

+5-5
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

bin/release

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fi
1414

1515
CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD`
1616

17-
for REMOTE in origin stomp amqp-ext amqp-lib amqp-bunny amqp-tools pheanstalk gearman sqs gps fs redis dbal null rdkafka enqueue simple-client enqueue-bundle job-queue test async-event-dispatcher
17+
for REMOTE in origin stomp amqp-ext amqp-lib amqp-bunny amqp-tools pheanstalk gearman sqs gps fs redis dbal null rdkafka enqueue simple-client enqueue-bundle job-queue test async-event-dispatcher mongodb
1818
do
1919
echo ""
2020
echo ""

bin/run-fun-test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
set -x
44
set -e
55

6-
COMPOSE_PROJECT_NAME=mqdev docker-compose run --workdir="/mqdev" --rm dev ./bin/test "$@"
6+
docker-compose run --workdir="/mqdev" --rm dev ./bin/test "$@"

bin/subtree-split

+3-1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ remote enqueue-bundle [email protected]:php-enqueue/enqueue-bundle.git
6363
remote job-queue [email protected]:php-enqueue/job-queue.git
6464
remote test [email protected]:php-enqueue/test.git
6565
remote async-event-dispatcher [email protected]:php-enqueue/async-event-dispatcher.git
66+
remote mongodb [email protected]:php-enqueue/mongodb.git
6667

6768
split 'pkg/enqueue' enqueue
6869
split 'pkg/simple-client' simple-client
@@ -83,4 +84,5 @@ split 'pkg/gps' gps
8384
split 'pkg/enqueue-bundle' enqueue-bundle
8485
split 'pkg/job-queue' job-queue
8586
split 'pkg/test' test
86-
split 'pkg/async-event-dispatcher' async-event-dispatcher
87+
split 'pkg/async-event-dispatcher' async-event-dispatcher
88+
split 'pkg/mongodb' mongodb

bin/test

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ waitForService redis 6379 50
3636
waitForService beanstalkd 11300 50
3737
waitForService gearmand 4730 50
3838
waitForService kafka 9092 50
39+
waitForService mongo 27017 50
40+
waitForService localstack 4576 50
3941

40-
php pkg/job-queue/Tests/Functional/app/console doctrine:database:create
42+
php pkg/job-queue/Tests/Functional/app/console doctrine:database:create --if-not-exists
4143
php pkg/job-queue/Tests/Functional/app/console doctrine:schema:update --force
4244

4345
#php pkg/enqueue-bundle/Tests/Functional/app/console.php config:dump-reference enqueue

composer.json

+8-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"enqueue/fs": "*@dev",
1717
"enqueue/null": "*@dev",
1818
"enqueue/dbal": "*@dev",
19+
"enqueue/mongodb": "*@dev",
1920
"enqueue/sqs": "*@dev",
2021
"enqueue/pheanstalk": "*@dev",
2122
"enqueue/gearman": "*@dev",
@@ -27,7 +28,7 @@
2728
"enqueue/simple-client": "*@dev",
2829
"enqueue/test": "*@dev",
2930
"enqueue/async-event-dispatcher": "*@dev",
30-
"queue-interop/queue-interop": "^0.6@dev",
31+
"queue-interop/queue-interop": "^0.6@dev|^1.0.0-alpha1",
3132
"queue-interop/amqp-interop": "^0.7@dev",
3233
"queue-interop/queue-spec": "^0.5.4@dev",
3334

@@ -60,7 +61,8 @@
6061
"platform": {
6162
"ext-amqp": "1.9.3",
6263
"ext-gearman": "1.1",
63-
"ext-rdkafka": "3.3"
64+
"ext-rdkafka": "3.3",
65+
"ext-mongodb": "1.3"
6466
}
6567
},
6668
"repositories": [
@@ -143,6 +145,10 @@
143145
{
144146
"type": "path",
145147
"url": "pkg/async-event-dispatcher"
148+
},
149+
{
150+
"type": "path",
151+
"url": "pkg/mongodb"
146152
}
147153
]
148154
}

docker-compose.yml

+23-5
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,20 @@ services:
1313
- zookeeper
1414
- google-pubsub
1515
- rabbitmqssl
16+
- mongo
17+
- localstack
1618
volumes:
1719
- './:/mqdev'
1820
environment:
1921
- AMQP_DSN=amqp://guest:guest@rabbitmq:5672/mqdev
2022
- AMQPS_DSN=amqps://guest:guest@rabbitmqssl:5671
21-
- DOCTINE_DSN=mysql://root:rootpass@mysql/mqdev
23+
- DOCTRINE_DSN=mysql://root:rootpass@mysql/mqdev
2224
- RABBITMQ_HOST=rabbitmq
2325
- RABBITMQ_USER=guest
2426
- RABBITMQ_PASSWORD=guest
2527
- RABBITMQ_VHOST=mqdev
2628
- RABBITMQ_AMQP__PORT=5672
27-
- RABBITMQ_STOMP_PORT=61613
29+
- RABBITMQ_STOMP_PORT=61613
2830
- DOCTRINE_DRIVER=pdo_mysql
2931
- DOCTRINE_HOST=mysql
3032
- DOCTRINE_PORT=3306
@@ -33,9 +35,11 @@ services:
3335
- DOCTRINE_PASSWORD=rootpass
3436
- REDIS_HOST=redis
3537
- REDIS_PORT=6379
36-
- AWS_SQS_KEY=$ENQUEUE_AWS__SQS__KEY
37-
- AWS_SQS_SECRET=$ENQUEUE_AWS__SQS__SECRET
38-
- AWS_SQS_REGION=$ENQUEUE_AWS__SQS__REGION
38+
- AWS_SQS_KEY=key
39+
- AWS_SQS_SECRET=secret
40+
- AWS_SQS_REGION=us-east-1
41+
- AWS_SQS_ENDPOINT=http://localstack:4576
42+
- AWS_SQS_VERSION=latest
3943
- BEANSTALKD_HOST=beanstalkd
4044
- BEANSTALKD_PORT=11300
4145
- BEANSTALKD_DSN=beanstalk://beanstalkd:11300
@@ -44,6 +48,7 @@ services:
4448
- RDKAFKA_PORT=9092
4549
- PUBSUB_EMULATOR_HOST=http://google-pubsub:8085
4650
- GCLOUD_PROJECT=mqdev
51+
- MONGO_DSN=mongodb://mongo
4752

4853
rabbitmq:
4954
image: 'enqueue/rabbitmq:latest'
@@ -102,6 +107,19 @@ services:
102107
image: 'google/cloud-sdk:latest'
103108
entrypoint: 'gcloud beta emulators pubsub start --host-port=0.0.0.0:8085'
104109

110+
mongo:
111+
image: mongo:3.7
112+
ports:
113+
- "27017:27017"
114+
115+
localstack:
116+
image: 'localstack/localstack:latest'
117+
ports:
118+
- '4576:4576'
119+
environment:
120+
HOSTNAME_EXTERNAL: 'localstack'
121+
SERVICES: 'sqs'
122+
105123
volumes:
106124
mysql-data:
107125
driver: local

docker/Dockerfile

+3-7
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ RUN set -x && \
1313
git clone https://github.com/pdezwart/php-amqp.git . && git checkout v1.9.3 && \
1414
phpize --clean && phpize && ./configure && make install
1515

16-
## confis
17-
18-
# RUN rm -f /etc/php/7.0/cli/conf.d/*xdebug.ini
19-
2016
## librdkafka
2117
RUN set -x && \
2218
apt-get update && \
@@ -27,10 +23,10 @@ RUN set -x && \
2723
git checkout v0.11.1 && \
2824
./configure && make && make install && \
2925
pecl install rdkafka && \
30-
echo "extension=rdkafka.so" > /etc/php/7.1/cli/conf.d/10-rdkafka.ini && \
31-
echo "extension=rdkafka.so" > /etc/php/7.1/fpm/conf.d/10-rdkafka.ini
26+
echo "extension=rdkafka.so" > /etc/php/7.2/cli/conf.d/10-rdkafka.ini && \
27+
echo "extension=rdkafka.so" > /etc/php/7.2/fpm/conf.d/10-rdkafka.ini
3228

33-
COPY ./php/cli.ini /etc/php/7.1/cli/conf.d/1-dev_cli.ini
29+
COPY ./php/cli.ini /etc/php/7.2/cli/conf.d/1-dev_cli.ini
3430
COPY ./bin/dev_entrypoiny.sh /usr/local/bin/entrypoint.sh
3531
RUN chmod u+x /usr/local/bin/entrypoint.sh
3632

docs/bundle/async_events.md

+10-11
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
@@ -113,7 +112,7 @@ class FooEventTransformer implements EventTransformer
113112
public function toMessage($eventName, Event $event = null)
114113
{
115114
$entity = $event->getSubject();
116-
$entityClass = get_class($event);
115+
$entityClass = get_class($entity);
117116
118117
$manager = $this->doctrine->getManagerForClass($entityClass);
119118
$meta = $manager->getClassMetadata($entityClass);
@@ -155,7 +154,7 @@ and register it:
155154
# app/config/config.yml
156155
157156
services:
158-
acme.foo_event_transofrmer:
157+
acme.foo_event_transformer:
159158
class: 'AcmeBundle\Listener\FooEventTransformer'
160159
arguments: ['@doctrine']
161160
tags:
@@ -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)

0 commit comments

Comments
 (0)