Skip to content

Commit

Permalink
Introduce Producer
Browse files Browse the repository at this point in the history
  • Loading branch information
WyriHaximus committed Feb 8, 2025
1 parent f797690 commit c2df1cc
Show file tree
Hide file tree
Showing 20 changed files with 370 additions and 104 deletions.
2 changes: 1 addition & 1 deletion bin/mammatus-queue
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ use Mammatus\ContainerFactory;
/**
* Create and run that one cron job
*/
exit((static fn (string $className): int => ContainerFactory::create()->get(App::class)->run($className))($className));
exit((static fn (string $className): int => ContainerFactory::create()->get(App::class)->run($className)->value)($className));
})($argv[1]);
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
"ext-json": "^8.2",
"composer-plugin-api": "^2.0",
"eventsauce/object-hydrator": "^1.6.1",
"mammatus/app": "dev-master",
"mammatus/app": "dev-introduce-run-tooling",
"mammatus/kubernetes-attributes": "^1",
"mammatus/kubernetes-contracts": "^1",
"mammatus/kubernetes-events": "^1",
"mammatus/life-cycle-events": "^2",
"mammatus/queue-attributes": "dev-main",
"mammatus/queue-contracts": "dev-main",
"mammatus/queue-contracts": "dev-introduce-producer",
"psr/container": "^1.1.2",
"psr/event-dispatcher": "^1.0",
"psr/log": "^2",
Expand All @@ -27,6 +27,7 @@
"wyrihaximus/broadcast-contracts": "^1.3",
"wyrihaximus/generative-composer-plugin-tooling": "^1",
"wyrihaximus/monolog-factory": "^2",
"wyrihaximus/psr-3-callable-throwable-logger": "^2.3",
"wyrihaximus/psr-3-context-logger": "^2.0",
"wyrihaximus/simple-twig": "^2.2.1",
"wyrihaximus/ticking-promise": "^3.1"
Expand Down
130 changes: 92 additions & 38 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion etc/generated_templates/AbstractList.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace Mammatus\Queue\Generated;
use Mammatus\Queue\Worker;
// phpcs:disable
/**
* Autogenerated file, do not edit. Changes will be overwritten on the next composer (install|update)
*/
Expand Down
28 changes: 28 additions & 0 deletions etc/generated_templates/WorkQueueMap.php.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
namespace Mammatus\Queue\Generated;
use Mammatus\Queue\Contracts\Work;
/**
* Autogenerated file, do not edit. Changes will be overwritten on the next composer (install|update)
*/
abstract class WorkQueueMap
{
private const MAP = [
{% for worker in workers %}
\{{ worker.dtoClass }}::class => '{{ worker.consumer.queue }}',
{% endfor %}
];
final protected function lookUp(Work $work): string
{
if (array_key_exists($work::class, self::MAP)) {
return self::MAP[$work::class];
}
throw new \RuntimeException('Unknown work: ' . $work::class);
}
}
Loading

0 comments on commit c2df1cc

Please sign in to comment.