Skip to content

Commit 100207c

Browse files
committed
Introduce Producer
1 parent f797690 commit 100207c

19 files changed

+281
-95
lines changed

bin/mammatus-queue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ use Mammatus\ContainerFactory;
1515
/**
1616
* Create and run that one cron job
1717
*/
18-
exit((static fn (string $className): int => ContainerFactory::create()->get(App::class)->run($className))($className));
18+
exit((static fn (string $className): int => ContainerFactory::create()->get(App::class)->run($className)->value)($className));
1919
})($argv[1]);

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
"ext-json": "^8.2",
99
"composer-plugin-api": "^2.0",
1010
"eventsauce/object-hydrator": "^1.6.1",
11-
"mammatus/app": "dev-master",
11+
"mammatus/app": "dev-introduce-run-tooling",
1212
"mammatus/kubernetes-attributes": "^1",
1313
"mammatus/kubernetes-contracts": "^1",
1414
"mammatus/kubernetes-events": "^1",
1515
"mammatus/life-cycle-events": "^2",
1616
"mammatus/queue-attributes": "dev-main",
17-
"mammatus/queue-contracts": "dev-main",
17+
"mammatus/queue-contracts": "dev-introduce-producer",
1818
"psr/container": "^1.1.2",
1919
"psr/event-dispatcher": "^1.0",
2020
"psr/log": "^2",

composer.lock

Lines changed: 40 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

etc/generated_templates/AbstractList.php.twig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ namespace Mammatus\Queue\Generated;
66
77
use Mammatus\Queue\Worker;
88
9-
// phpcs:disable
109
/**
1110
* Autogenerated file, do not edit. Changes will be overwritten on the next composer (install|update)
1211
*/
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Mammatus\Queue\Generated;
6+
7+
use Mammatus\Queue\Contracts\Work;
8+
9+
/**
10+
* Autogenerated file, do not edit. Changes will be overwritten on the next composer (install|update)
11+
*/
12+
abstract class WorkQueueMap
13+
{
14+
private const MAP = [
15+
{% for worker in workers %}
16+
\{{ worker.dtoClass }}::class => '{{ worker.consumer.queue }}',
17+
{% endfor %}
18+
];
19+
20+
final protected function lookUp(Work $work): string
21+
{
22+
if (array_key_exists($work::class, self::MAP)) {
23+
return self::MAP[$work::class];
24+
}
25+
26+
throw new \RuntimeException('Unknown work: ' . $work::class);
27+
}
28+
}

etc/qa/phpcs.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<file>../../src</file>
1010
<file>../../tests</file>
1111

12-
<exclude-pattern>src/Generated/*</exclude-pattern>
12+
<exclude-pattern>src/Generated/Hydrator.php</exclude-pattern>
1313

1414
<rule ref="WyriHaximus-OSS" />
1515
</ruleset>

etc/qa/phpstan.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ parameters:
1515
classesAllowedToBeExtended:
1616
- Composer\IO\NullIO
1717
- Mammatus\Queue\Generated\AbstractList
18+
- Mammatus\Queue\Generated\WorkQueueMap
19+
- RuntimeException
1820

1921
includes:
2022
- ../../vendor/wyrihaximus/async-test-utilities/rules.neon

0 commit comments

Comments
 (0)