Skip to content

Conversation

@basert
Copy link
Contributor

@basert basert commented Jan 29, 2025

No description provided.

@basert basert marked this pull request as draft January 29, 2025 13:26
@basert basert force-pushed the amqp branch 13 times, most recently from e5ccf5c to 78bf379 Compare February 3, 2025 12:13
@basert basert marked this pull request as ready for review February 3, 2025 12:21
@basert basert force-pushed the amqp branch 2 times, most recently from a0f161a to 2bd04c8 Compare February 3, 2025 16:11
Copy link
Contributor

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;
Copy link
Contributor

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()

Copy link
Contributor Author

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
Copy link
Contributor

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);
Copy link
Contributor

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?

Copy link
Contributor Author

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";
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

@christyjacob4 christyjacob4 left a 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

@basert
Copy link
Contributor Author

basert commented Feb 4, 2025

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.

Base automatically changed from 0.7.x to main February 4, 2025 14:52
@christyjacob4 christyjacob4 merged commit a100316 into main Feb 4, 2025
1 check passed
@christyjacob4 christyjacob4 deleted the amqp branch February 4, 2025 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants