NAME
Messaging::Message::Generator - versatile message generator
SYNOPSIS
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 ...
}
DESCRIPTION
This module provides a versatile message generator that can be useful for stress testing or benchmarking messaging brokers or libraries.
METHODS
The following methods are available:
- new([OPTIONS])
-
return a new Messaging::Message::Generator object (class method)
- message()
-
return a newly generated Messaging::Message object
OPTIONS
When creating a message generator, the following options can be given:
- text
-
integer specifying if the body is text string (as opposed to binary string) or not; supported values are
0
(never text),1
(always text) or0-1
(randomly text or not) - body-length
-
integer specifying the length of the body
- body-entropy
-
integer specifying the entropy of the body
- header-count
-
integer specifying the number of header fields
- header-name-prefix
-
string to prepend to each header field name
- header-name-length
-
integer specifying the length of each header field name (prefix not included)
- header-name-entropy
-
integer specifying the entropy of each header field name
- header-value-prefix
-
string to prepend to each header field value
- header-value-length
-
integer specifying the length of each header field value (prefix not included)
- header-value-entropy
-
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 valuea
X-Y
range, meaning a discrete uniform distribution between the two given integers, bounds includeda
X^Y
range, meaning a pseudo normal distribution between the two given integers, bounds included
All the entropy options interpret their integer value this way:
0
means a single character, repeated1
means hexadecimal characters2
means Base64 characters (with-
instead of/
and_
instead od+
)3
means printable 7-bit ASCII characters4
means random characters (including Unicode, except for binary bodies)
SEE ALSO
AUTHOR
Lionel Cons http://cern.ch/lionel.cons
Copyright (C) CERN 2011-2021