Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Producer #11

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading