Skip to content

Commit ca1c930

Browse files
author
oylenshpeegul
committed
add hello world
1 parent 350088a commit ca1c930

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

receive.pl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env perl
2+
3+
use v5.24;
4+
use warnings;
5+
use Net::AMQP::RabbitMQ;
6+
7+
my $mq = Net::AMQP::RabbitMQ->new();
8+
9+
$mq->connect('localhost', { user => 'guest', password => 'guest' });
10+
11+
$mq->channel_open(1);
12+
13+
$mq->queue_declare(1, 'hello');
14+
15+
$mq->consume(1, 'hello');
16+
17+
say ' [*] Waiting for messages. To exit press CTRL-C';
18+
while (1) {
19+
my $received = $mq->recv(0);
20+
say " [x] Received '$received->{body}'";
21+
}

send.pl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env perl
2+
3+
use v5.24;
4+
use warnings;
5+
use Net::AMQP::RabbitMQ;
6+
7+
my $mq = Net::AMQP::RabbitMQ->new;
8+
9+
$mq->connect('localhost', { user => 'guest', password => 'guest' });
10+
11+
$mq->channel_open(1);
12+
13+
$mq->queue_declare(1, 'hello');
14+
15+
$mq->publish(1, 'hello', 'Hello, World!');
16+
17+
say " [x] Sent 'Hello World!' ";
18+
19+
$mq->disconnect;

0 commit comments

Comments
 (0)