1Messaging::Message::GenUesreartoCro(n3t)ributed Perl DocMuemsesnatgaitnigo:n:Message::Generator(3)
2
3
4
6 Messaging::Message::Generator - versatile message generator
7
9 use Messaging::Message::Generator;
10
11 # create the generator
12 $mg = Messaging::Message::Generator->new(
13 "text" => "0-1",
14 "body-length" => "0-1000",
15 "body-entropy" => "1-4",
16 "header-count" => "2^6",
17 "header-name-length" => "10-20",
18 "header-name-entropy" => "1-2",
19 "header-name-prefix" => "rnd-",
20 "header-value-length" => "20-40",
21 "header-value-entropy" => "0-3",
22 );
23
24 # use it to generate 10 messages
25 foreach (1 .. 10) {
26 $msg = $mg->message();
27 ... do something with it ...
28 }
29
31 This module provides a versatile message generator that can be useful
32 for stress testing or benchmarking messaging brokers or libraries.
33
35 The following methods are available:
36
37 new([OPTIONS])
38 return a new Messaging::Message::Generator object (class method)
39
40 message()
41 return a newly generated Messaging::Message object
42
44 When creating a message generator, the following options can be given:
45
46 text
47 integer specifying if the body is text string (as opposed to binary
48 string) or not; supported values are 0 (never text), 1 (always
49 text) or "0-1" (randomly text or not)
50
51 body-length
52 integer specifying the length of the body
53
54 body-entropy
55 integer specifying the entropy of the body
56
57 header-count
58 integer specifying the number of header fields
59
60 header-name-prefix
61 string to prepend to each header field name
62
63 header-name-length
64 integer specifying the length of each header field name (prefix not
65 included)
66
67 header-name-entropy
68 integer specifying the entropy of each header field name
69
70 header-value-prefix
71 string to prepend to each header field value
72
73 header-value-length
74 integer specifying the length of each header field value (prefix
75 not included)
76
77 header-value-entropy
78 integer specifying the entropy of each header field value
79
80 All the options default to 0 or the empty string.
81
82 All the integer options can be given either:
83
84 · a positive integer "X", meaning exactly this value
85
86 · a "X-Y" range, meaning a discrete uniform distribution between the
87 two given integers, bounds included
88
89 · a "X^Y" range, meaning a pseudo normal distribution between the two
90 given integers, bounds included
91
92 All the entropy options interpret their integer value this way:
93
94 · 0 means a single character, repeated
95
96 · 1 means hexadecimal characters
97
98 · 2 means Base64 characters (with "-" instead of "/" and "_" instead
99 od "+")
100
101 · 3 means printable 7-bit ASCII characters
102
103 · 4 means random characters (including Unicode, except for binary
104 bodies)
105
107 Messaging::Message.
108
110 Lionel Cons <http://cern.ch/lionel.cons>
111
112 Copyright (C) CERN 2011-2016
113
114
115
116perl v5.28.1 2016-10-05 Messaging::Message::Generator(3)