NAME
Messaging::Message::Generator - versatile message generator
SYNOPSIS
use Messaging::Message::Generator;
# create the generator
$mg = Messaging::Message::Generator->new(
"body-content" => "binary",
"body-size" => 1024,
);
# 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:
- body-content
-
string specifying the body content type; depending on this value, the body will be made of:
- base64
-
only Base64 characters
- binary
-
anything
- index
-
the message index number, starting at 1, optionally adjusted to match the
body-size
(this is the default) - text
-
only printable 7-bit ASCII characters
- body-size
-
integer specifying the body size
- header-count
-
integer specifying the number of header fields
- header-value-size
-
integer specifying the size of each header field value (default is -32)
- header-name-size
-
integer specifying the size of each header field name (default is -16)
- header-name-prefix
-
string to prepend to all header field names (default is
rnd-
)
Note: all integer options can be either positive (meaning exactly this value) or negative (meaning randomly distributed around the value).
For instance:
$mg = Messaging::Message::Generator->new(
"header-count" => 10,
"header-value-size" => -20,
);
will generate messages with exactly 10 random header fields, each field value having a random size between 0 and 40 and normally distributed around 20.
SEE ALSO
AUTHOR
Lionel Cons http://cern.ch/lionel.cons
Copyright CERN 2011-2012