1Mojo::RabbitMQ::Client:U:sCeornsCuomnetrr(i3bpumt)ed PerMlojDoo:c:uRmaebnbtiattMiQo:n:Client::Consumer(3pm)
2
3
4
6 Mojo::RabbitMQ::Client::Consumer - simple Mojo::RabbitMQ::Client based
7 consumer
8
10 use Mojo::RabbitMQ::Client::Consumer;
11 my $consumer = Mojo::RabbitMQ::Consumer->new(
12 url => 'amqp://guest:guest@127.0.0.1:5672/?exchange=mojo&queue=mojo',
13 defaults => {
14 qos => {prefetch_count => 1},
15 queue => {durable => 1},
16 consumer => {no_ack => 0},
17 }
18 );
19
20 $consumer->catch(sub { die "Some error caught in Consumer" } );
21 $consumer->on('success' => sub { say "Consumer ready" });
22 $consumer->on(
23 'message' => sub {
24 my ($consumer, $message) = @_;
25
26 $consumer->channel->ack($message)->deliver;
27 }
28 );
29 $consumer->consume_p->wait;
30
31 Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
32
35 Mojo::RabbitMQ::Client::Consumer inherits all events from
36 Mojo::EventEmitter and can emit the following new ones.
37
39 Mojo::RabbitMQ::Client::Consumer has following attributes.
40
42 Mojo::RabbitMQ::Client::Consumer inherits all methods from
43 Mojo::EventEmitter and implements the following new ones.
44
46 Mojo::RabbitMQ::Client
47
49 Copyright (C) 2015-2017, Sebastian Podjasek and others
50
51 This program is free software, you can redistribute it and/or modify it
52 under the terms of the Artistic License version 2.0.
53
54
55
56perl v5.34.0 2022-01-M2o1jo::RabbitMQ::Client::Consumer(3pm)