-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add AMQP broker #30
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
Conversation
e5ccf5c to
78bf379
Compare
a0f161a to
2bd04c8
Compare
src/Queue/RetryableError.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets move this to a folder called src/Queue/Error/Retryable.php
|
|
||
| public function retry(Queue $queue, int $limit = null): void; | ||
|
|
||
| public function getQueueSize(Queue $queue, bool $failedJobs = false): int; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to call this getQueueSize() or just size()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
size is not specific enough, as this here is in context of the Publisher.
|
|
||
| namespace Utopia\Queue\Broker; | ||
|
|
||
| readonly class Queue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other two adapters here AMQP & Redis both implement Publisher and Consumer interface. Whereas Queue.php looks like an unrelated class in the context of a Broker. Lets move it to src/Queue/Queue.php
|
|
||
| // 1. Declare the exchange and a dead-letter-exchange. | ||
| $channel->exchange_declare($queue->namespace, AMQPExchangeType::TOPIC, durable: true, auto_delete: false); | ||
| $channel->exchange_declare("{$queue->namespace}.failed", AMQPExchangeType::TOPIC, durable: true, auto_delete: false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
queue->namespace.failed is just utopia-queue.failed right?
We need a failed queue per queue like utopia-queue.v1-functions.failed etc.
Can you also clarify the different queues we're using here? compared to what we had before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an exchange, not a queue. queues are subscribed to an exchange with their routing key.
| { | ||
| $queueName = $queue->name; | ||
| if ($failedJobs) { | ||
| $queueName = $queueName . ".failed"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the queue name should also have the namespace prefix as it was previously
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Namespace is done by exchange, not by queue.
christyjacob4
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should target this to main and release the next minor version atleast. not a patch
We can't, the current main has all the changes for coroutines and they are not ready for appwrite. |
No description provided.