Messaging::Message::Generator - versatile message generator
use Messaging::Message::Generator; # create the generator $mg = Messaging::Message::Generator->new( "text" => "0-1", "body-length" => "0-1000", "body-entropy" => "1-4", "header-count" => "2^6", "header-name-length" => "10-20", "header-name-entropy" => "1-2", "header-name-prefix" => "rnd-", "header-value-length" => "20-40", "header-value-entropy" => "0-3", ); # use it to generate 10 messages foreach (1 .. 10) { $msg = $mg->message(); ... do something with it ... }
This module provides a versatile message generator that can be useful for stress testing or benchmarking messaging brokers or libraries.
The following methods are available:
return a new Messaging::Message::Generator object (class method)
return a newly generated Messaging::Message object
When creating a message generator, the following options can be given:
integer specifying if the body is text string (as opposed to binary string) or not; supported values are 0 (never text), 1 (always text) or 0-1 (randomly text or not)
0
1
0-1
integer specifying the length of the body
integer specifying the entropy of the body
integer specifying the number of header fields
string to prepend to each header field name
integer specifying the length of each header field name (prefix not included)
integer specifying the entropy of each header field name
string to prepend to each header field value
integer specifying the length of each header field value (prefix not included)
integer specifying the entropy of each header field value
All the options default to 0 or the empty string.
All the integer options can be given either:
a positive integer X, meaning exactly this value
X
a X-Y range, meaning a discrete uniform distribution between the two given integers, bounds included
X-Y
a X^Y range, meaning a pseudo normal distribution between the two given integers, bounds included
X^Y
All the entropy options interpret their integer value this way:
0 means a single character, repeated
1 means hexadecimal characters
2 means Base64 characters (with - instead of / and _ instead od +)
2
-
/
_
+
3 means printable 7-bit ASCII characters
3
4 means random characters (including Unicode, except for binary bodies)
4
Messaging::Message.
Lionel Cons http://cern.ch/lionel.cons
Copyright (C) CERN 2011-2021
To install Messaging::Message, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Messaging::Message
CPAN shell
perl -MCPAN -e shell install Messaging::Message
For more information on module installation, please visit the detailed CPAN module installation guide.