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

Delay, ttl, priority, in producer #149

Merged
merged 12 commits into from
Aug 3, 2017
Merged

Conversation

makasim
Copy link
Member

@makasim makasim commented Aug 2, 2017

<?php

use Enqueue\AmqpLib\AmqpConnectionFactory;

$context = (new AmqpConnectionFactory('amqp://'))->createContext();

$context->createProducer()
    ->setDeliveryDelay(5000) // 5 sec
    ->setPriority(2)
    ->setTimeToLive(60000)  // 1 minute

    ->send($context->createQueue('foo'), $context->createMessage('Hello!'))
;

if a feature is not supported. the setter throws an exception. for example DeliverDelayNotSupportedException

<?php

use Enqueue\AmqpLib\AmqpConnectionFactory;
use Interop\Queue\DeliveryDelayNotSupportedException;

$context = (new AmqpConnectionFactory('amqp://'))->createContext();

$producer = $context->createProducer();

try {
    // catch it if you can work without delay feature or you want to mute it.
    $producer->setDeliveryDelay(5000);
} catch (DeliveryDelayNotSupportedException $e) {}

@makasim makasim changed the title Delay ttl priority in producer Delay, ttl, priority, in producer Aug 2, 2017
@makasim makasim merged commit 89e1eeb into master Aug 3, 2017
ASKozienko pushed a commit that referenced this pull request Nov 2, 2018
@Steveb-p Steveb-p deleted the delay-ttl-priority-in-producer branch June 21, 2019 09:06
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.

1 participant