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 <melo@simplicidade.org>
This commit is contained in:
@@ -12,6 +12,7 @@ my ($topic, $factor) = @ARGV;
|
|||||||
die "Usage: publisher.pl topic [msgs_per_call]\n" unless $topic;
|
die "Usage: publisher.pl topic [msgs_per_call]\n" unless $topic;
|
||||||
|
|
||||||
$factor = 1 unless $factor;
|
$factor = 1 unless $factor;
|
||||||
|
my @factors = (1 .. $factor);
|
||||||
|
|
||||||
my $cv = AE::cv;
|
my $cv = AE::cv;
|
||||||
|
|
||||||
@@ -36,7 +37,9 @@ my @readline;
|
|||||||
chomp($line);
|
chomp($line);
|
||||||
return unless length($line);
|
return unless length($line);
|
||||||
|
|
||||||
$r->publish($topic, "$c: $line");
|
my @messages = map {"$c.$_: $line"} @factors;
|
||||||
|
|
||||||
|
$r->publish($topic, @messages);
|
||||||
$c++;
|
$c++;
|
||||||
$_[0]->push_read(@readline);
|
$_[0]->push_read(@readline);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user