thegreenwebfoundation / greencheck-api

The green web foundation API
https://www.thegreenwebfoundation.org/
Apache License 2.0
9 stars 3 forks source link

Make a separate queue for consuming #29

Closed mrchrisadams closed 4 years ago

mrchrisadams commented 5 years ago

Hi @arendjantetteroo, so I've set up a new worker class GreencheckDataDumpProcessor, as there didn't seem to be a clear way to use the existing classes to consume from multiple queues.

I'm struggling a bit here. I'll mention in a comment.

mrchrisadams commented 5 years ago

Where I'm struggling.

Everything I read so far seems to suggest we set up queues implicitly with the enqueue library, by making a consumer or producer refer to them in code, usually with their channel name.

This doesn't seem to be working as I'd expect though.

Trying where we consume things on the queue

When the queue name in the worker from greencheck_prio to greencheck, then try to run a worker, like so:

./bin/console enqueue:consume --setup-broker -vvv greencheck

I see this issue here:


In ConsumeCommand.php line 125:

  [LogicException]
  There is no such queue "greencheck". Available are "default", "greencheck_prio"

Exception trace:
 () at /Users/chrisadams/Code/tgwf/thegreenwebfoundation/apps/api/vendor/enqueue/enqueue/Symfony/Client/ConsumeCommand.php:125
 Enqueue\Symfony\Client\ConsumeCommand->execute() at /Users/chrisadams/Code/tgwf/thegreenwebfoundation/apps/api/vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /Users/chrisadams/Code/tgwf/thegreenwebfoundation/apps/api/vendor/symfony/console/Application.php:935
 Symfony\Component\Console\Application->doRunCommand() at /Users/chrisadams/Code/tgwf/thegreenwebfoundation/apps/api/vendor/symfony/framework-bundle/Console/Application.php:89
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /Users/chrisadams/Code/tgwf/thegreenwebfoundation/apps/api/vendor/symfony/console/Application.php:269
 Symfony\Component\Console\Application->doRun() at /Users/chrisadams/Code/tgwf/thegreenwebfoundation/apps/api/vendor/symfony/framework-bundle/Console/Application.php:75
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /Users/chrisadams/Code/tgwf/thegreenwebfoundation/apps/api/vendor/symfony/console/Application.php:145
 Symfony\Component\Console\Application->run() at /Users/chrisadams/Code/tgwf/thegreenwebfoundation/apps/api/bin/console:38

enqueue:consume [--message-limit MESSAGE-LIMIT] [--time-limit TIME-LIMIT] [--memory-limit MEMORY-LIMIT] [--niceness NICENESS] [--setup-broker] [--receive-timeout RECEIVE-TIMEOUT] [--logger [LOGGER]] [--skip [SKIP]] [-c|--client [CLIENT]] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> [<client-queue-names>...]

Trying where we put things on the queue instead

The thing is when I try to declare a queue at the other end, as a producer, like so:

./bin/console tgwf:greencheck:csvchecker

…that seems to raise an error too:

In GenericDriver.php line 91:

  There is no route for command "greencheck".

tgwf:greencheck:csvchecker [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>

It's not clear to me how I should be declaring queues here. If i'm not using getSubscribedCommand, what should I be using to declare queues here?

mrchrisadams commented 5 years ago

OK, thanks @arendjantetteroo - I see the issue now 🤦‍♂

Gonna deploy, and allocate the workers to generate the data we need.

arendjantetteroo commented 4 years ago

@mrchrisadams is this still relevant. I will close it, feel free to reopen when it's relevant.