This file is indexed.

/usr/share/doc/libmojo-rabbitmq-client-perl/examples/simple.pl is in libmojo-rabbitmq-client-perl 0.1.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/perl
use Mojo::Base -strict;
use Mojo::Log;
use Mojo::RabbitMQ::Client;

my $log = Mojo::Log->new(threshold => 'trace');
my $amqp = Mojo::RabbitMQ::Client->new(
  url => 'rabbitmq://guest:guest@127.0.0.1:5672/');

$amqp->catch(sub { $log->error("Error connecting to RabbitMQ") });
$amqp->on(connect => sub { $log->debug("Connected to RabbitMQ host") });
$amqp->on(
  open => sub {
    my ($self) = @_;

    $log->debug("Openned connection to RabbitMQ host");

    my $channel = Mojo::RabbitMQ::Channel->new();
    $channel->catch(sub { $log->debug("Failed to open channel") });
    $channel->on(
      open => sub {
        my ($channel) = @_;

        $log->debug("Opened channel to RabbitMQ host");

        $log->debug("Publish sample message to `test_queue` queue");
        my $publish = $channel->publish(
          exchange    => 'test',
          routing_key => 'test_queue',
          body        => 'Test message',
          mandatory   => 0,
          immediate   => 0,
          header      => {}
        );
        $publish->catch(sub { $log->error("Message publish failure") });
        $publish->on(success => sub { $log->debug("Message published") });
        $publish->on(return  => sub { $log->warn("Message returned to us") });
        $publish->deliver();

        my $consumer = $channel->consume(queue => 'test_queue');
        $consumer->catch(sub { $log->error("Error while consuming queue") });
        $consumer->on(success => sub { $log->debug("Consumed") });
        $consumer->on(message => sub { $log->debug("Received a message") });
        $consumer->deliver;
      }
    );
    $channel->on(close => sub { $log->error('Channel closed') });

    $self->open_channel($channel);
  }
);
$amqp->on(close      => sub { $log->error("RabbitMQ connection closed") });
$amqp->on(disconnect => sub { $log->error("RabbitMQ disconnected") });
$amqp->connect();

$amqp->start();