Skip to content

Commit 1d0135a

Browse files
committed
Merge branch 'master' into pr-250
2 parents e7ee2e5 + f58729b commit 1d0135a

File tree

210 files changed

+3697
-997
lines changed

Some content is hidden

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

210 files changed

+3697
-997
lines changed

.travis.yml

+7
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ matrix:
2020
- php: 7.0
2121
env: SYMFONY_VERSION=3.0.* UNIT_TESTS=true
2222
- php: 7.1
23+
env: SYMFONY_VERSION=4.0.* UNIT_TESTS=true
24+
- php: 7.1
25+
env: SYMFONY_VERSION=3.4.* UNIT_TESTS=true
26+
- php: 7.2
2327
services: docker
2428
env: SYMFONY_VERSION=2.8.* FUNCTIONAL_TESTS=true PREPARE_CONTAINER=true
2529
- php: 7.1
@@ -31,6 +35,9 @@ matrix:
3135
- php: 7.1
3236
services: docker
3337
env: SYMFONY_VERSION=3.3.* FUNCTIONAL_TESTS=true PREPARE_CONTAINER=true
38+
- php: 7.1
39+
services: docker
40+
env: SYMFONY_VERSION=4.0.* FUNCTIONAL_TESTS=true PREPARE_CONTAINER=true
3441
- php: 7.1
3542
services: docker
3643
env: SYMFONY_VERSION=3.3.* RDKAFKA_TESTS=true PREPARE_CONTAINER=true

CHANGELOG.md

+201
Large diffs are not rendered by default.

README.md

+19-14
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
# Message Queue. Development Repository
1+
**Enqueue** is production ready, battle-tested messaging solution for PHP. Provides a common way for programs to create, send, read messages.
2+
3+
This is a main development repository. It provides a friendly environment for productive development and testing of all Enqueue related features&packages.
24

35
[![Gitter](https://badges.gitter.im/php-enqueue/Lobby.svg)](https://gitter.im/php-enqueue/Lobby)
46
[![Build Status](https://travis-ci.org/php-enqueue/enqueue-dev.png?branch=master)](https://travis-ci.org/php-enqueue/enqueue-dev)
57
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
68

7-
This is where all development happens. The repository provides a friendly environment for productive development and testing of all enqueue related packages.
8-
99
Features:
1010

1111
* [Feature rich](docs/quick_tour.md).
12-
* Implements [JMS](https://docs.oracle.com/javaee/7/api/javax/jms/package-summary.html) like transports based on [queue-interop](https://github.com/queue-interop/queue-interop) interfaces.
12+
13+
* Adopts [queue interoperable](https://github.com/queue-interop/queue-interop) interfaces (inspired by [Java JMS](https://docs.oracle.com/javaee/7/api/javax/jms/package-summary.html)).
14+
* Battle-tested. Used in production.
1315
* Supported transports
1416
* [AMQP(s)](docs/transport/amqp.md) based on [PHP AMQP extension](https://github.com/pdezwart/php-amqp).
1517
[![Build Status](https://travis-ci.org/php-enqueue/amqp-ext.png?branch=master)](https://travis-ci.org/php-enqueue/amqp-ext)
@@ -63,21 +65,24 @@ Features:
6365
[![Build Status](https://travis-ci.org/php-enqueue/null.png?branch=master)](https://travis-ci.org/php-enqueue/null)
6466
[![Total Downloads](https://poser.pugx.org/enqueue/null/d/total.png)](https://packagist.org/packages/enqueue/null)
6567
[![Latest Stable Version](https://poser.pugx.org/enqueue/null/version.png)](https://packagist.org/packages/enqueue/null)
66-
* [Symfony bundle](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/bundle/quick_tour.md)
67-
* [Magento1 extension](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/magento/quick_tour.md)
68-
* [Laravel extension](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/laravel/quick_tour.md)
69-
* [Message bus](http://www.enterpriseintegrationpatterns.com/patterns/messaging/MessageBus.html) support.
70-
* [RPC over MQ](https://www.rabbitmq.com/tutorials/tutorial-one-php.html) support.
68+
* [Symfony bundle](docs/bundle/quick_tour.md)
69+
* [Magento1 extension](docs/magento/quick_tour.md)
70+
* [Magento2 module](docs/magento2/quick_tour.md)
71+
* [Laravel extension](docs/laravel/quick_tour.md)
72+
* [Yii2. Amqp driver](docs/yii/amqp_driver.md)
73+
* [Message bus](docs/quick_tour.md#client) support.
74+
* [RPC over MQ](docs/quick_tour.md#remote-procedure-call-rpc) support.
7175
* Temporary queues support.
72-
* Well designed components decoupled and reusable.
73-
* Carefully tested including unit and functional tests.
76+
* Well designed, decoupled and reusable components.
77+
* Carefully tested (unit & functional).
7478
* For more visit [quick tour](docs/quick_tour.md).
7579

7680
## Resources
7781

78-
* [Quick tour](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/quick_tour.md)
79-
* [Documentation](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md)
80-
* [Blog](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md#blogs)
82+
* [Site](https://enqueue.forma-pro.com/)
83+
* [Quick tour](docs/quick_tour.md)
84+
* [Documentation](docs/index.md)
85+
* [Blog](docs/index.md#blogs)
8186
* [Questions](https://gitter.im/php-enqueue/Lobby)
8287
* [Issue Tracker](https://github.com/php-enqueue/enqueue-dev/issues)
8388

bin/build-enqueue-dev-image.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
set -x
5+
6+
(cd docker && docker build --rm --force-rm --no-cache --pull --squash --tag "enqueue/dev:latest" -f Dockerfile .)
7+
(cd docker && docker login --username="$DOCKER_USER" --password="$DOCKER_PASSWORD")
8+
(cd docker && docker push "enqueue/dev:latest")

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

composer.json

+12-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"name": "enqueue/enqueue-dev",
33
"type": "project",
4-
"minimum-stability": "stable",
4+
"minimum-stability": "beta",
5+
"homepage": "https://enqueue.forma-pro.com/",
56
"require": {
67
"php": ">=5.6",
78
"enqueue/enqueue": "*@dev",
@@ -26,20 +27,21 @@
2627
"enqueue/simple-client": "*@dev",
2728
"enqueue/test": "*@dev",
2829
"enqueue/async-event-dispatcher": "*@dev",
29-
"queue-interop/queue-interop": "^0.6@dev",
30+
"queue-interop/queue-interop": "^0.6@dev|^1.0.0-alpha1",
3031
"queue-interop/amqp-interop": "^0.7@dev",
31-
"queue-interop/queue-spec": "^0.5.1@dev",
32+
"queue-interop/queue-spec": "^0.5.4@dev",
3233

3334
"phpunit/phpunit": "^5",
3435
"doctrine/doctrine-bundle": "~1.2",
3536
"predis/predis": "^1.1",
36-
"symfony/monolog-bundle": "^2.8|^3",
37-
"symfony/browser-kit": "^2.8|^3",
38-
"symfony/expression-language": "^2.8|^3",
39-
"symfony/event-dispatcher": "^2.8|^3",
40-
"symfony/console": "^2.8|^3",
37+
"symfony/monolog-bundle": "^2.8|^3|^4",
38+
"symfony/browser-kit": "^2.8|^3|^4",
39+
"symfony/expression-language": "^2.8|^3|^4",
40+
"symfony/event-dispatcher": "^2.8|^3|^4",
41+
"symfony/console": "^2.8|^3|^4",
4142
"friendsofphp/php-cs-fixer": "^2",
42-
"empi89/php-amqp-stubs": "*@dev"
43+
"empi89/php-amqp-stubs": "*@dev",
44+
"php-http/client-common": "^1.7@dev"
4345
},
4446
"autoload": {
4547
"files": [
@@ -56,7 +58,7 @@
5658
"config": {
5759
"bin-dir": "bin",
5860
"platform": {
59-
"ext-amqp": "1.7",
61+
"ext-amqp": "1.9.3",
6062
"ext-gearman": "1.1",
6163
"ext-rdkafka": "3.3"
6264
}

docker-compose.yml

+17-19
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ version: '2'
33
services:
44
dev:
55
image: enqueue/dev:latest
6-
# build: { context: docker, dockerfile: Dockerfile }
76
depends_on:
87
- rabbitmq
98
- mysql
@@ -20,23 +19,23 @@ services:
2019
- AMQP_DSN=amqp://guest:guest@rabbitmq:5672/mqdev
2120
- AMQPS_DSN=amqps://guest:guest@rabbitmqssl:5671
2221
- DOCTINE_DSN=mysql://root:rootpass@mysql/mqdev
23-
- SYMFONY__RABBITMQ__HOST=rabbitmq
24-
- SYMFONY__RABBITMQ__USER=guest
25-
- SYMFONY__RABBITMQ__PASSWORD=guest
26-
- SYMFONY__RABBITMQ__VHOST=mqdev
27-
- SYMFONY__RABBITMQ__AMQP__PORT=5672
28-
- SYMFONY__RABBITMQ__STOMP__PORT=61613
29-
- SYMFONY__DB__DRIVER=pdo_mysql
30-
- SYMFONY__DB__HOST=mysql
31-
- SYMFONY__DB__PORT=3306
32-
- SYMFONY__DB__NAME=mqdev
33-
- SYMFONY__DB__USER=root
34-
- SYMFONY__DB__PASSWORD=rootpass
35-
- SYMFONY__REDIS__HOST=redis
36-
- SYMFONY__REDIS__PORT=6379
37-
- AWS__SQS__KEY=$ENQUEUE_AWS__SQS__KEY
38-
- AWS__SQS__SECRET=$ENQUEUE_AWS__SQS__SECRET
39-
- AWS__SQS__REGION=$ENQUEUE_AWS__SQS__REGION
22+
- RABBITMQ_HOST=rabbitmq
23+
- RABBITMQ_USER=guest
24+
- RABBITMQ_PASSWORD=guest
25+
- RABBITMQ_VHOST=mqdev
26+
- RABBITMQ_AMQP__PORT=5672
27+
- RABBITMQ_STOMP_PORT=61613
28+
- DOCTRINE_DRIVER=pdo_mysql
29+
- DOCTRINE_HOST=mysql
30+
- DOCTRINE_PORT=3306
31+
- DOCTRINE_DB_NAME=mqdev
32+
- DOCTRINE_USER=root
33+
- DOCTRINE_PASSWORD=rootpass
34+
- REDIS_HOST=redis
35+
- 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
4039
- BEANSTALKD_HOST=beanstalkd
4140
- BEANSTALKD_PORT=11300
4241
- BEANSTALKD_DSN=beanstalk://beanstalkd:11300
@@ -48,7 +47,6 @@ services:
4847

4948
rabbitmq:
5049
image: 'enqueue/rabbitmq:latest'
51-
# build: { context: docker, dockerfile: Dockerfile.rabbitmq }
5250
environment:
5351
- RABBITMQ_DEFAULT_USER=guest
5452
- RABBITMQ_DEFAULT_PASS=guest

docker/Dockerfile

+20-7
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,34 @@ FROM formapro/nginx-php-fpm:latest-all-exts
33
## libs
44
RUN set -x && \
55
apt-get update && \
6-
apt-get install -y wget curl openssl ca-certificates nano netcat php-dev php-redis git python
6+
apt-get install -y --no-install-recommends --no-install-suggests wget curl openssl ca-certificates nano netcat php-dev php-redis git python
7+
8+
RUN set -x && \
9+
apt-get update && \
10+
apt-get install -y --no-install-recommends --no-install-suggests php-dev librabbitmq-dev make && \
11+
mkdir -p $HOME/php-amqp && \
12+
cd $HOME/php-amqp && \
13+
git clone https://github.com/pdezwart/php-amqp.git . && git checkout v1.9.3 && \
14+
phpize --clean && phpize && ./configure && make install
715

816
## confis
917

1018
# RUN rm -f /etc/php/7.0/cli/conf.d/*xdebug.ini
1119

1220
## librdkafka
13-
RUN git clone https://github.com/edenhill/librdkafka.git /root/librdkafka
14-
RUN cd /root/librdkafka && git checkout v0.11.0-RC2 && ./configure && make && make install
15-
RUN pecl install rdkafka
16-
RUN echo "extension=rdkafka.so" > /etc/php/7.1/cli/conf.d/10-rdkafka.ini
17-
RUN echo "extension=rdkafka.so" > /etc/php/7.1/fpm/conf.d/10-rdkafka.ini
21+
RUN set -x && \
22+
apt-get update && \
23+
apt-get install -y --no-install-recommends --no-install-suggests g++ php-pear php-dev && \
24+
mkdir -p $HOME/librdkafka && \
25+
cd $HOME/librdkafka && \
26+
git clone https://github.com/edenhill/librdkafka.git . && \
27+
git checkout v0.11.1 && \
28+
./configure && make && make install && \
29+
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
1832

1933
COPY ./php/cli.ini /etc/php/7.1/cli/conf.d/1-dev_cli.ini
20-
COPY ./php/amqp.so /usr/lib/php/20160303/amqp.so
2134
COPY ./bin/dev_entrypoiny.sh /usr/local/bin/entrypoint.sh
2235
RUN chmod u+x /usr/local/bin/entrypoint.sh
2336

docker/php/amqp.so

-609 KB
Binary file not shown.

docs/bundle/async_events.md

+8-9
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

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

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

+2-2
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/functional_testing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class FooTest extends WebTestCase
7272
*/
7373
private function getProducer()
7474
{
75-
return $this->client->getContainer()->get('enqueue.producer');
75+
return $this->client->getContainer()->get(TraceableProducer::class);
7676
}
7777
}
7878
```

0 commit comments

Comments
 (0)