The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Daemonise::Plugin::RabbitMQ - Daemonise RabbitMQ plugin

VERSION

version 2.13

SYNOPSIS

    use Daemonise;

    my $d = Daemonise->new();

    # this is the rabbitMQ queue name we eventually create and subscribe to
    $d->name("queue_name");

    $d->debug(1);
    $d->foreground(1) if $d->debug;
    $d->config_file('/path/to/some.conf');

    $d->load_plugin('RabbitMQ');

    $d->is_worker(1); # make it create its own queue
    $d->configure;

    # fetch next message from our subscribed queue
    $msg = $d->dequeue;

    # send message to some_queue and don't wait (rabbitMQ publish)
    # $msg can be anything that encodes into JSON
    $d->queue('some_queue', $msg);

    # send message and wait for response (rabbitMQ RPC)
    my $response = $d->queue('some_queue', $msg);

    # worker that wants a reply from us, not necessarily from an RPC call
    my $worker = $d->reply_queue;

    # does NOT reply to caller, no matter what, usually not what you want
    $d->dont_reply;

    # at last, acknowledge message as processed
    $d->ack;

ATTRIBUTES

is_worker

rabbit_host

rabbit_port

rabbit_user

rabbit_pass

rabbit_vhost

rabbit_exchange

rabbit_channel

rabbit_consumer_tag

last_delivery_tag

admin_queue

reply_queue

correlation_id

mq

SUBROUTINES/METHODS provided

configure

dont_reply

queue

dequeue

ack

AUTHOR

Lenz Gschwendtner <norbu09@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Lenz Gschwendtner.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.