Skip to content

Commit b5da3b1

Browse files
authored
Merge pull request #489 from php-enqueue/clean-up-queue-consumer
remove bc layer.
2 parents 0d591c4 + b72d012 commit b5da3b1

26 files changed

+457
-356
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ script:
5151
- if [ "$PHP_CS_FIXER" = true ]; then IFS=$'\n'; COMMIT_SCA_FILES=($(git diff --name-only --diff-filter=ACMRTUXB "${TRAVIS_COMMIT_RANGE}")); unset IFS; fi
5252
- if [ "$PHP_CS_FIXER" = true ]; then ./bin/php-cs-fixer fix --config=.php_cs.dist -v --dry-run --stop-on-violation --using-cache=no --path-mode=intersection -- "${COMMIT_SCA_FILES[@]}"; fi
5353
- if [ "$UNIT_TESTS" = true ]; then bin/phpunit --exclude-group=functional; fi
54-
- if [ "$FUNCTIONAL_TESTS" = true ]; then bin/run-fun-test.sh --exclude-group=rdkafka; fi
55-
- if [ "RDKAFKA_TESTS" = true ]; then bin/run-fun-test.sh --group=rdkafka; fi
54+
- if [ "$FUNCTIONAL_TESTS" = true ]; then bin/test.sh --exclude-group=rdkafka; fi
55+
- if [ "RDKAFKA_TESTS" = true ]; then bin/test.sh --group=rdkafka; fi
5656

5757
notifications:
5858
webhooks:

bin/dev

-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ while getopts "bustefcdp" OPTION; do
2020
f)
2121
./bin/php-cs-fixer fix
2222
;;
23-
t)
24-
./bin/run-fun-test.sh "$2"
25-
;;
2623
c)
2724
docker-compose run -e CHANGELOG_GITHUB_TOKEN=${CHANGELOG_GITHUB_TOKEN:-""} --workdir="/mqdev" --rm generate-changelog github_changelog_generator --future-release "$2" --simple-list
2825
;;

bin/run-fun-test.sh

-6
This file was deleted.

bin/test.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
set -x
4+
set -e
5+
6+
docker-compose run --workdir="/mqdev" --rm dev ./docker/bin/test.sh "$@"

docker-compose.yml

+2-6
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,10 @@ services:
7777
- "6379:6379"
7878

7979
mysql:
80-
image: mariadb:10
81-
volumes:
82-
- mysql-data:/var/lib/mysql
80+
image: mysql:5.7
8381
environment:
8482
MYSQL_ROOT_PASSWORD: rootpass
83+
MYSQL_DATABASE: mqdev
8584

8685
generate-changelog:
8786
image: enqueue/generate-changelog:latest
@@ -120,6 +119,3 @@ services:
120119
HOSTNAME_EXTERNAL: 'localstack'
121120
SERVICES: 'sqs'
122121

123-
volumes:
124-
mysql-data:
125-
driver: local

docker/bin/refresh-mysql-database.php

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
use Enqueue\Dbal\DbalConnectionFactory;
4+
5+
require_once getcwd().'/vendor/autoload.php';
6+
7+
$dsn = getenv('DOCTRINE_DSN');
8+
$database = trim(parse_url($dsn, PHP_URL_PATH), '/');
9+
10+
$dbalContext = (new DbalConnectionFactory($dsn))->createContext();
11+
12+
$dbalContext->getDbalConnection()->getSchemaManager()->dropAndCreateDatabase($database);
13+
$dbalContext->getDbalConnection()->exec('USE '.$database);
14+
$dbalContext->createDataBaseTable();
15+
16+
echo 'MySQL Database is updated'.PHP_EOL;

bin/test renamed to docker/bin/test.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ waitForService kafka 9092 50
3939
waitForService mongo 27017 50
4040
waitForService localstack 4576 50
4141

42-
php pkg/job-queue/Tests/Functional/app/console doctrine:database:create --if-not-exists
43-
php pkg/job-queue/Tests/Functional/app/console doctrine:schema:update --force
42+
php docker/bin/refresh-mysql-database.php
4443

4544
#php pkg/enqueue-bundle/Tests/Functional/app/console.php config:dump-reference enqueue
4645
bin/phpunit "$@"

docs/contribution.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ Once you did it you can work on a feature or bug fix.
1818
To run tests
1919

2020
```
21-
./bin/dev -t
21+
./bin/test.sh
2222
```
2323

2424
or for a package only:
2525

2626

2727
```
28-
./bin/dev -t pkg/enqueue
28+
./bin/test.sh pkg/enqueue
2929
```
3030

3131
## Commit

pkg/dbal/Tests/DbalConnectionFactoryConfigTest.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,12 @@ public static function provideConfigs()
8080
yield [
8181
'pdo_mysql:',
8282
[
83-
'lazy' => true,
8483
'connection' => [
8584
'url' => 'pdo_mysql://root@localhost',
8685
],
86+
'table_name' => 'enqueue',
87+
'polling_interval' => 1000,
88+
'lazy' => true,
8789
],
8890
];
8991

@@ -114,10 +116,12 @@ public static function provideConfigs()
114116
yield [
115117
'pdo_mysql://user:pass@host:10001/db',
116118
[
117-
'lazy' => true,
118119
'connection' => [
119120
'url' => 'pdo_mysql://user:pass@host:10001/db',
120121
],
122+
'table_name' => 'enqueue',
123+
'polling_interval' => 1000,
124+
'lazy' => true,
121125
],
122126
];
123127

pkg/dbal/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"license": "MIT",
88
"require": {
99
"php": "^7.1.3",
10-
"queue-interop/queue-interop": "^0.7@dev",
10+
"queue-interop/queue-interop": "0.7.x-dev",
1111
"doctrine/dbal": "~2.5",
1212
"ramsey/uuid": "^3"
1313
},

pkg/enqueue-bundle/Resources/config/services.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
parameters:
2-
enqueue.queue_consumer.enable_subscription_consumer: false
32
enqueue.queue_consumer.default_idle_time: 0
4-
enqueue.queue_consumer.default_receive_timeout: 10
3+
enqueue.queue_consumer.default_receive_timeout: 10000
54

65
services:
76
enqueue.consumption.extensions:
@@ -18,8 +17,6 @@ services:
1817
- '@enqueue.consumption.extensions'
1918
- '%enqueue.queue_consumer.default_idle_time%'
2019
- '%enqueue.queue_consumer.default_receive_timeout%'
21-
calls:
22-
- ['enableSubscriptionConsumer', ['%enqueue.queue_consumer.enable_subscription_consumer%']]
2320

2421
# Deprecated. To be removed in 0.10.
2522
enqueue.consumption.queue_consumer:

pkg/enqueue/Consumption/Context.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,17 @@ public function setPsrProcessor(PsrProcessor $psrProcessor)
136136
}
137137

138138
/**
139-
* @return \Exception
139+
* @return \Throwable
140140
*/
141141
public function getException()
142142
{
143143
return $this->exception;
144144
}
145145

146146
/**
147-
* @param \Exception $exception
147+
* @param \Throwable $exception
148148
*/
149-
public function setException(\Exception $exception)
149+
public function setException(\Throwable $exception)
150150
{
151151
$this->exception = $exception;
152152
}

0 commit comments

Comments
 (0)