简体   繁体   English

Amazon SQS 临时队列 (PHP)

[英]Amazon SQS temporary queues (PHP)

I'm trying to create a PHP implementation using Amazon SQS with PHP SDK V3.我正在尝试使用 Amazon SQS 和 PHP SDK V3 创建 PHP 实现。 It would be really usefull for some tasks to use disposable/temporary queues.对于某些任务使用一次性/临时队列非常有用。

Per reading Amazon docs I found it's possible in Java SDK ( https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-temporary-queues.html ). Per reading Amazon docs I found it's possible in Java SDK ( https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-temporary-queues.html ).

I try to use the "#" sintax, but with no success.我尝试使用“#”sintax,但没有成功。 Also passing it as an Attribute, also nothing.也将它作为属性传递,也没有。

Basic code:基本代码:

$result = $client -> createQueue(
    array(
            'QueueName' =>          'Test',
            'Attributes' => array(
                                    'VirtualQueueName' => 'temp'
            )
    )
);

Does anyone knows the same docs in PHP or a way for doing this without Java SDK?.有谁知道 PHP 中的相同文档或在没有 Java SDK 的情况下执行此操作的方法?

Thanks in advance!提前致谢!

It isn't actually creating temporary queues.它实际上并没有创建临时队列。 It is creating a single queue, and adds a 'virtual queue identifier' as an attribute to the message.它正在创建单个队列,并将“虚拟队列标识符”作为属性添加到消息中。 Then, a process reads messages from the queue and forwards it to virtual queues.然后,一个进程从队列中读取消息并将其转发到虚拟队列。

Looks rather complex since you need to run code from Github to implement this virtual capability.看起来相当复杂,因为您需要从 Github 运行代码来实现此虚拟功能。

Instead, I would recommend you just create a normal queue with a unique name and then delete it when it is not required .相反,我建议您只创建一个具有唯一名称的普通队列,然后在不需要时将其删除

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM