logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Mojo::RabbitMQ::Client::LocalQueue - Callback queue

Description

       Mojo::RabbitMQ::Client::LocalQueue is a queue for callbacks expecting some content to be received.

Methods

       Mojo::RabbitMQ::Client::LocalQueue implements following methods:

   get
         $queue->get(sub { process_message($_[0]) })

       Registers a callback which is executed when new message is pushed to queue.

   push
         $queue->push("Some content");
         $queue->push({objects => 'are also welcome});

       Pushes content to queue and also drains all declared callbacks.

Name

       Mojo::RabbitMQ::Client::LocalQueue - Callback queue

See Also

       Mojo::RabbitMQ::Client, Mojo::RabbitMQ::Client::Channel

Synopsis

         use Mojo::RabbitMQ::Client::LocalQueue

         my $queue = Mojo::RabbitMQ::Client::LocalQueue->new();

         # Register callback when content appears
         $queue->get(sub { say "got expected content: " . $_[0] });

         # Push some content to consume
         $queue->push("It Works!");

         # This prints:
         # got expected content: It Works!

See Also