From 1ff696d616df875e2d2e6de4e9c404dcd824c599 Mon Sep 17 00:00:00 2001 From: Pedro Melo Date: Mon, 21 Jul 2014 05:11:43 +0100 Subject: [PATCH] Add support for the factors parameter in publisher.pl: We can multiply the number of messages delivery by factor, thus allowing to test support for publishing multiple messages Signed-off-by: Pedro Melo --- examples/publisher.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/publisher.pl b/examples/publisher.pl index 0128d8e..e9786dd 100755 --- a/examples/publisher.pl +++ b/examples/publisher.pl @@ -12,6 +12,7 @@ my ($topic, $factor) = @ARGV; die "Usage: publisher.pl topic [msgs_per_call]\n" unless $topic; $factor = 1 unless $factor; +my @factors = (1 .. $factor); my $cv = AE::cv; @@ -36,7 +37,9 @@ my @readline; chomp($line); return unless length($line); - $r->publish($topic, "$c: $line"); + my @messages = map {"$c.$_: $line"} @factors; + + $r->publish($topic, @messages); $c++; $_[0]->push_read(@readline); }