fmq 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,4 +1,17 @@
1
+ == 0.3.0 2008-08-06
2
+
3
+ * 2 minor changes:
4
+ * replaced the mongrel handler by rack so that it can be used by many servers and in different configurations
5
+ * removed the old yml style config and replaced it by a new rubyish config style (see config.ru)
6
+ * 5 tiny changes:
7
+ * seperated the admin interface handler
8
+ * removed the configuration stuff that belonged to the old yml file from queue_manager and boot classes
9
+ * removed that the command fmq can be used to start the server (rackup can be used by now)
10
+ * admin interface is now seperated to several files (javascript, css, ...)
11
+ * admin interface is validated by W3C validatior for xhtml strict and css 2.1 compliance
12
+
1
13
  == 0.2.0 2008-06-28
14
+
2
15
  * 3 minor enhancements:
3
16
  * added a BaseQueue that can be used by other queues to reduce overhead
4
17
  * created unit test for most important classes
@@ -9,6 +22,7 @@
9
22
  * update some parts of the website and admin interface
10
23
 
11
24
  == 0.1.1 2008-06-23
25
+
12
26
  * 7 tiny enhancements:
13
27
  * make the queue manager check if the poll or put to or from a queue is possible
14
28
  * changed mongrel handler to no raise an exception on client error (performance issue)
@@ -21,4 +35,4 @@
21
35
  == 0.1.0 2008-06-22
22
36
 
23
37
  * 1 minor enhancement:
24
- * This is the initial release
38
+ * This is the initial release
data/README.txt CHANGED
@@ -34,11 +34,12 @@ stores it’s internal data in an FIFO in system memory.
34
34
  == FEATURES/PROBLEMS:
35
35
 
36
36
  * FIFO message store
37
- * easy setup and maintainance of system
37
+ * easy setup and maintenance of system
38
38
  * using http for communication
39
39
  * changeable queue implementation
40
40
  * ruby client lib
41
41
  * simple ajax admin interface
42
+ * implements a rack server stack
42
43
 
43
44
  == SYNOPSIS:
44
45
 
data/bin/fmq CHANGED
@@ -19,9 +19,8 @@
19
19
  #
20
20
  # == Command line options
21
21
  #
22
- # usage: /usr/bin/fmq [create <project_name>]
22
+ # usage: /usr/bin/fmq create <project_name>
23
23
  #
24
- # * Invocation without parameter will start server
25
24
  # * Invocation with parameter <em>create</em> *project_name*
26
25
  # will create a project folder with the name *project_name*
27
26
  begin
@@ -32,12 +31,10 @@ rescue LoadError
32
31
  end
33
32
 
34
33
  if File.basename($0) == "fmq" then
35
- if ARGV.size == 0 then
36
- FreeMessageQueue::Boot.start_server
37
- elsif ARGV.size == 2 && ARGV[0] == "create" then
34
+ if ARGV.size == 2 && ARGV[0] == "create" then
38
35
  FreeMessageQueue::Boot.create_project(ARGV[1])
39
36
  else
40
- puts "usage: #{$0} [create <project_name>]"
37
+ puts "usage: #{$0} create <project_name>"
41
38
  end
42
39
  end
43
40
 
data/config/hoe.rb CHANGED
@@ -8,7 +8,7 @@ RUBYFORGE_PROJECT = 'fmq' # The unix name for your project
8
8
  HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
9
9
  DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
10
10
  EXTRA_DEPENDENCIES = [
11
- # ['activesupport', '>= 1.3.1']
11
+ ['rack', '>= 0.4.0']
12
12
  ] # An array of rubygem dependencies [name, version]
13
13
 
14
14
  @config_file = "~/.rubyforge/user-config.yml"
@@ -61,7 +61,7 @@ $hoe = Hoe.new(GEM_NAME, VERS) do |p|
61
61
 
62
62
  # == Optional
63
63
  p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
64
- #p.extra_deps = EXTRA_DEPENDENCIES
64
+ p.extra_deps = EXTRA_DEPENDENCIES
65
65
 
66
66
  #p.spec_extras = {} # A hash of extra values to set in the gemspec.
67
67
  end
@@ -70,4 +70,4 @@ CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
70
70
  PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
71
71
  $hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
72
72
  $hoe.rsync_args = '-av --delete --ignore-errors'
73
- $hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
73
+ $hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
@@ -1,240 +1,50 @@
1
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
2
3
  <head>
3
- <title>Free Message Queue</title>
4
- <LINK REL="SHORTCUT ICON" HREF="images/logo.png">
5
- <script type="text/javascript" src="prototype.js"></script>
6
- <script type="text/javascript">
7
- var ADMIN_QUEUE_PATH = '/admin/queue';
8
-
9
- function toggle_element (element_id) {
10
- $(element_id).disabled = !$(element_id).disabled;
11
- }
12
-
13
- function updateSelects() {
14
- new Ajax.Request(ADMIN_QUEUE_PATH, {
15
- method:'GET',
16
- onSuccess: function(transport) {
17
- queues = transport.responseText.evalJSON();
18
- fillSelectWithQueuePaths("select-message-receive", queues);
19
- fillSelectWithQueuePaths("select-message-send", queues);
20
- fillTableSpaceWithQueues("queue-table-space", queues);
21
- },
22
- onFailure: function(transport){ alert(transport.getHeader("ERROR")) }
23
- });
24
- }
25
-
26
- function updateTable() {
27
- new Ajax.Request(ADMIN_QUEUE_PATH, {
28
- method:'GET',
29
- onSuccess: function(transport) {
30
- queues = transport.responseText.evalJSON();
31
- fillTableSpaceWithQueues("queue-table-space", queues);
32
- },
33
- onFailure: function(transport){ alert(transport.getHeader("ERROR")) }
34
- });
35
- }
4
+ <title>Free Message Queue</title>
5
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
6
+ <link rel="shortcut icon" href="images/logo.png" />
7
+ <link href="stylesheets/application.css" rel="stylesheet" type="text/css" />
8
+ <script type="text/javascript" src="javascript/prototype.js"></script>
9
+ <script type="text/javascript" src="javascript/application.js"></script>
10
+ </head>
11
+ <body onload="updateSelects(); updateTable();">
12
+ <div id="container">
13
+ <div id="header">
14
+ <div id="logo"></div>
15
+ <h1>Free Message Queue - Admin Interface</h1>
16
+ <h3>the easy http queue system for ruby and all others ...</h3>
17
+ </div>
18
+ <div id="content">
19
+ <!-- LIST QUEUE -->
20
+ <h1>Queues</h1>
21
+ <p id="queue-table-space"></p>
22
+ <input type="button" value="update" onclick="updateTable();" />
36
23
 
37
- function fillTableSpaceWithQueues(table_space, queues) {
38
- var table = '<table style="width: 100%; border: 1px solid #292C44">' +
39
- '<tr><th>Queue name</th><th>queue size</th><th>messages in queue</th><th>options</th></tr>';
40
-
41
- queues.each ( function (queue) {
42
- table += "<tr><td>" + queue[0] + "</td><td>" + queue[1] + "/" + queue[2] +"</td><td>" + queue[3] + "/" +
43
- queue[4] +'</td><td><input type="button" value="delete" onClick="deleteQueue(\'' + queue[0] + '\');"/></td></tr>';
44
- });
45
-
46
- table += '</table>';
47
-
48
- $(table_space).innerHTML = table;
49
- }
50
-
51
- function fillSelectWithQueuePaths(select_id, queues) {
52
- // remove all current
53
- while ($(select_id).hasChildNodes()) {
54
- $(select_id).removeChild($(select_id).lastChild);
55
- }
56
-
57
- queues.each ( function (queue) {
58
- elem = document.createElement("option");
59
- elem.label = elem.value = elem.text = queue[0];
60
- $(select_id).appendChild(elem);
61
- });
62
- }
63
-
64
- function getMessageFromQueue(button_id, select_id, output_id) {
65
- new Ajax.Request($(select_id).value, {
66
- method:'GET',
67
- onLoading: function(transport) {
68
- toggle_element(button_id);
69
- },
70
- onSuccess: function(transport) {
71
- if (transport.status == 200) {
72
- $(output_id).innerHTML = transport.responseText;
73
- updateTable();
74
- } else {
75
- alert("There is no message in the queue");
76
- $(output_id).innerHTML = " == NO MESSAGE IN THE QUEUE ==";
77
- }
78
- toggle_element(button_id);
79
- },
80
- onFailure: function(transport){
81
- alert(transport.getHeader("ERROR"));
82
- toggle_element(button_id);
83
- }
84
- });
85
- }
86
-
87
- function sendMessageToQueue(button_id, select_id, input_id) {
88
- new Ajax.Request($(select_id).value, {
89
- method:'POST',
90
- postBody: $(input_id).value,
91
- onLoading: function(transport) {
92
- toggle_element(button_id);
93
- },
94
- onSuccess: function(transport) {
95
- updateTable();
96
- toggle_element(button_id);
97
- },
98
- onFailure: function(transport) {
99
- alert(transport.getHeader("ERROR"));
100
- toggle_element(button_id);
101
- }
102
- });
103
- }
24
+ <!-- CREATE QUEUE -->
25
+ <h1>Create queue</h1>
26
+ <p>Queue path: /<input id="queue-create-path" /></p>
27
+ <p>Maximum messages: <input id="queue-create-max-messages" value="1000000" /></p>
28
+ <p>Maximum queue size in kb, mb, gb: <input id="queue-create-size" value="100mb" /></p>
29
+ <input type="button" value="create" onclick="createQueue()" />
104
30
 
105
- function createQueue() {
106
- var config = {
107
- "path": "/" + $("queue-create-path").value,
108
- "max-messages": parseInt($("queue-create-max-messages").value),
109
- "max-size": $("queue-create-size").value
110
- }
111
-
112
- new Ajax.Request(ADMIN_QUEUE_PATH, {
113
- method: 'POST',
114
- postBody: "_method=create&data=" + Object.toJSON(config),
115
- onSuccess: function(transport) {
116
- updateSelects();
117
- updateTable();
118
- alert("Queue /" + $("queue-create-path").value + " created successfully");
119
- },
120
- onFailure: function(transport){ alert(transport.getHeader("ERROR")) }
121
- });
122
- }
31
+ <!-- SEND MESSAGE TO QUEUE -->
32
+ <h1>Send message to queue</h1>
33
+ <p>Queue path: <select id="post-queue-name"><option>NONE</option></select></p>
34
+ <p><textarea id="post-body" class="block-text" rows="5" cols="80" style="width: 780px; height: 100px;"></textarea></p>
35
+ <input id="post-button" type="button" value="send"
36
+ onclick="sendMessageToQueue('post-button', 'post-queue-name', 'post-body');"/>
123
37
 
124
- function deleteQueue(path) {
125
- new Ajax.Request(ADMIN_QUEUE_PATH, {
126
- method: 'POST',
127
- postBody: "_method=delete&path=" + path,
128
- onSuccess: function(transport) {
129
- updateSelects();
130
- updateTable();
131
- alert("Queue " + path + " successfully deleted");
132
- },
133
- onFailure: function(transport){ alert(transport.getHeader("ERROR")) }
134
- });
135
- }
136
- </script>
137
- <style type="text/css" id="test">
138
- body {
139
- background-color: #687486;
140
- font-family: arial;
141
- font-size: 1em;
142
- }
143
- img {
144
- border: 0px;
145
- }
146
- a {
147
- color: #C7DAD1;
148
- }
149
- #container {
150
- margin: 10px auto;
151
- background-color: #C7DAD1;
152
- width: 800px;
153
- border: 1px solid #292C44;
154
- }
155
- #header {
156
- background-color: #2F3B4E;
157
- padding: 20px 20px 20px 30px;
158
- color: #C7DAD1;
159
- }
160
- #logo {
161
- width: 64px;
162
- height: 64px;
163
- float: right;
164
- margin-top: 20px;
165
- margin-right: 20px;
166
- background-image: url(images/logo.png);
167
- }
168
- #content {
169
- padding: 10px;
170
- }
171
- #content h1 {
172
- font-size: 1.4em;
173
- }
174
- #footer {
175
- color: #C7DAD1;
176
- background-color: #2F3B4E;
177
- text-align: center;
178
- padding: 10px;
179
- font-weight: bold;
180
- }
181
- .block-text {
182
- font-family:"Courier New", Courier, monospace;
183
- border: 1px dashed #C7DAD1;
184
- background-color: #000;
185
- color: #C7DAD1;
186
- padding: 5px;
187
- font-size: 0.8em;
188
- }
189
- th {
190
- text-align: left;
191
- background-color: #2F3B4E;
192
- color: #C7DAD1;
193
- padding: 5px;
194
- }
195
- td {
196
- text-align: center;
197
- padding: 5px;
198
- }
199
- </style>
200
- </head>
201
- <body onLoad="updateSelects(); updateTable();">
202
- <div id="container">
203
- <div id="header">
204
- <div id="logo"></div>
205
- <h1>Free Message Queue - Admin Interface</h1>
206
- <h3>the easy http queue system for ruby and all others ...</h3>
207
- </div>
208
- <div id="content">
209
- <!-- LIST QUEUE -->
210
- <h1>Queues</h1>
211
- <p><div id="queue-table-space"></div></p>
212
- <input type="button" value="update" onClick="updateTable();" />
213
-
214
- <!-- CREATE QUEUE -->
215
- <h1>Create queue</h1>
216
- <p>Queue path: /<input id="queue-create-path" /></p>
217
- <p>Maximum messages: <input id="queue-create-max-messages" value="1000000" /></p>
218
- <p>Maximum queue size in kb, mb, gb: <input id="queue-create-size" value="100mb" /></p>
219
- <input type="button" value="create" onClick="createQueue()" />
220
-
221
- <!-- SEND MESSAGE TO QUEUE -->
222
- <h1>Send message to queue</h1>
223
- <p>Queue path: <select id="select-message-send"></select></p>
224
- <p><textarea id="queue-message-send" class="block-text" style="width: 780px; height: 100px;"></textarea></p>
225
- <input id="send-message-queue-button" type="button" value="send"
226
- onClick="sendMessageToQueue('send-message-queue-button', 'select-message-send', 'queue-message-send');"/>
227
-
228
- <!-- GET MESSAGE FROM QUEUE -->
229
- <h1>Get a message from queue</h1>
230
- <p>Queue path: <select id="select-message-receive"></select></p>
231
- <pre id="queue-message-get" class="block-text"></pre>
232
- <input id="get-message-queue-button" type="button" value="get one"
233
- onClick="getMessageFromQueue('get-message-queue-button', 'select-message-receive', 'queue-message-get');"/>
234
- </div>
235
- <div id="footer">
236
- This interface is based on <a href="http://www.prototypejs.org/">prototype</a>
237
- </div>
238
- </div>
38
+ <!-- GET MESSAGE FROM QUEUE -->
39
+ <h1>Get a message from queue</h1>
40
+ <p>Queue path: <select id="get-queue-name"><option>NONE</option></select></p>
41
+ <pre id="get-body" class="block-text"></pre>
42
+ <input id="get-button" type="button" value="get one"
43
+ onclick="getMessageFromQueue('get-button', 'get-queue-name', 'get-body');"/>
44
+ </div>
45
+ <div id="footer">
46
+ This interface is based on <a href="http://www.prototypejs.org/">prototype</a>
47
+ </div>
48
+ </div>
239
49
  </body>
240
- </html>
50
+ </html>
@@ -0,0 +1,127 @@
1
+ var ADMIN_QUEUE_PATH = '/admin/backend';
2
+
3
+ function toggle_element (element_id) {
4
+ $(element_id).disabled = !$(element_id).disabled;
5
+ }
6
+
7
+ function updateSelects() {
8
+ new Ajax.Request(ADMIN_QUEUE_PATH, {
9
+ method:'GET',
10
+ onSuccess: function(transport) {
11
+ queues = transport.responseText.evalJSON();
12
+ fillSelectWithQueuePaths("get-queue-name", queues);
13
+ fillSelectWithQueuePaths("post-queue-name", queues);
14
+ fillTableSpaceWithQueues("queue-table-space", queues);
15
+ },
16
+ onFailure: function(transport){ alert(transport.getHeader("ERROR")) }
17
+ });
18
+ }
19
+
20
+ function updateTable() {
21
+ new Ajax.Request(ADMIN_QUEUE_PATH, {
22
+ method:'GET',
23
+ onSuccess: function(transport) {
24
+ queues = transport.responseText.evalJSON();
25
+ fillTableSpaceWithQueues("queue-table-space", queues);
26
+ },
27
+ onFailure: function(transport){ alert(transport.getHeader("ERROR")) }
28
+ });
29
+ }
30
+
31
+ function fillTableSpaceWithQueues(table_space, queues) {
32
+ var table = '<table style="width: 100%; border: 1px solid #292C44">' +
33
+ '<tr><th>Queue name</th><th>queue size</th><th>messages in queue</th><th>options</th></tr>';
34
+
35
+ queues.each ( function (queue) {
36
+ table += "<tr><td>" + queue[0] + "</td><td>" + queue[1] + "/" + queue[2] +"</td><td>" + queue[3] + "/" +
37
+ queue[4] +'</td><td><input type="button" value="delete" onClick="deleteQueue(\'' + queue[0] + '\');"/></td></tr>';
38
+ });
39
+
40
+ table += '</table>';
41
+
42
+ $(table_space).innerHTML = table;
43
+ }
44
+
45
+ function fillSelectWithQueuePaths(select_id, queues) {
46
+ // remove all current
47
+ while ($(select_id).hasChildNodes()) {
48
+ $(select_id).removeChild($(select_id).lastChild);
49
+ }
50
+
51
+ queues.each ( function (queue) {
52
+ elem = document.createElement("option");
53
+ elem.label = elem.value = elem.text = queue[0];
54
+ $(select_id).appendChild(elem);
55
+ });
56
+ }
57
+
58
+ function getMessageFromQueue(button_id, select_id, output_id) {
59
+ new Ajax.Request($(select_id).value, {
60
+ method:'GET',
61
+ onLoading: function(transport) {
62
+ toggle_element(button_id);
63
+ },
64
+ onSuccess: function(transport) {
65
+ if (transport.status == 200) {
66
+ $(output_id).innerHTML = transport.responseText;
67
+ updateTable();
68
+ } else {
69
+ alert("There is no message in the queue");
70
+ $(output_id).innerHTML = " == NO MESSAGE IN THE QUEUE ==";
71
+ }
72
+ toggle_element(button_id);
73
+ },
74
+ onFailure: function(transport){
75
+ alert(transport.getHeader("ERROR"));
76
+ toggle_element(button_id);
77
+ }
78
+ });
79
+ }
80
+
81
+ function sendMessageToQueue(button_id, select_id, input_id) {
82
+ new Ajax.Request($(select_id).value, {
83
+ method:'POST',
84
+ postBody: $(input_id).value,
85
+ contentType: "text/plain",
86
+ onLoading: function(transport) {
87
+ toggle_element(button_id);
88
+ },
89
+ onSuccess: function(transport) {
90
+ updateTable();
91
+ toggle_element(button_id);
92
+ },
93
+ onFailure: function(transport) {
94
+ alert(transport.getHeader("ERROR"));
95
+ toggle_element(button_id);
96
+ }
97
+ });
98
+ }
99
+
100
+ function createQueue() {
101
+ new Ajax.Request(ADMIN_QUEUE_PATH, {
102
+ method: 'POST',
103
+ postBody: "_method=create" +
104
+ "&path=" + "/" + $("queue-create-path").value +
105
+ "&max_messages=" + parseInt($("queue-create-max-messages").value) +
106
+ "&max_size=" + $("queue-create-size").value,
107
+ onSuccess: function(transport) {
108
+ updateSelects();
109
+ updateTable();
110
+ alert("Queue /" + $("queue-create-path").value + " created successfully");
111
+ },
112
+ onFailure: function(transport){ alert(transport.getHeader("ERROR")) }
113
+ });
114
+ }
115
+
116
+ function deleteQueue(path) {
117
+ new Ajax.Request(ADMIN_QUEUE_PATH, {
118
+ method: 'POST',
119
+ postBody: "_method=delete&path=" + path,
120
+ onSuccess: function(transport) {
121
+ updateSelects();
122
+ updateTable();
123
+ alert("Queue " + path + " successfully deleted");
124
+ },
125
+ onFailure: function(transport){ alert(transport.getHeader("ERROR")) }
126
+ });
127
+ }
@@ -0,0 +1,61 @@
1
+ body {
2
+ background-color: #687486;
3
+ font-family: arial;
4
+ font-size: 1em;
5
+ }
6
+ img {
7
+ border: 0px;
8
+ }
9
+ a {
10
+ color: #C7DAD1;
11
+ }
12
+ #container {
13
+ margin: 10px auto;
14
+ background-color: #C7DAD1;
15
+ width: 800px;
16
+ border: 1px solid #292C44;
17
+ }
18
+ #header {
19
+ background-color: #2F3B4E;
20
+ padding: 20px 20px 20px 30px;
21
+ color: #C7DAD1;
22
+ }
23
+ #logo {
24
+ width: 64px;
25
+ height: 64px;
26
+ float: right;
27
+ margin-top: 20px;
28
+ margin-right: 20px;
29
+ background-image: url(../images/logo.png);
30
+ }
31
+ #content {
32
+ padding: 10px;
33
+ }
34
+ #content h1 {
35
+ font-size: 1.4em;
36
+ }
37
+ #footer {
38
+ color: #C7DAD1;
39
+ background-color: #2F3B4E;
40
+ text-align: center;
41
+ padding: 10px;
42
+ font-weight: bold;
43
+ }
44
+ .block-text {
45
+ font-family:"Courier New", Courier, monospace;
46
+ border: 1px dashed #C7DAD1;
47
+ background-color: #000;
48
+ color: #C7DAD1;
49
+ padding: 5px;
50
+ font-size: 0.8em;
51
+ }
52
+ th {
53
+ text-align: left;
54
+ background-color: #2F3B4E;
55
+ color: #C7DAD1;
56
+ padding: 5px;
57
+ }
58
+ td {
59
+ text-align: center;
60
+ padding: 5px;
61
+ }
@@ -0,0 +1,86 @@
1
+ require "fmq"
2
+
3
+ # load all local queues (from project directory)
4
+ Dir.glob("queues/*.rb").each { |f| require f }
5
+
6
+ # setup log level of free message queue
7
+ FreeMessageQueue.log_level("info")
8
+
9
+ # =====================================================
10
+ # create and configure the queue manager
11
+ # =====================================================
12
+ queue_manager = FreeMessageQueue::QueueManager.new()
13
+
14
+ queue_manager.setup do |qm|
15
+ # if someone pushes to a queue that don't exists
16
+ # the queue manager will create one for you if the option
17
+ # <em>auto_create_queues</em> is <b>true</b>. This
18
+ # is a useful option if you are in development,
19
+ # the queue will be a FreeMessageQueue::SyncronizedQueue by default
20
+ qm.auto_create_queues = true
21
+
22
+ # =====================================================
23
+ # if you want some queues right from startup
24
+ # define there url and constraints here
25
+ # =====================================================
26
+
27
+ qm.setup_queue do |q|
28
+ # the path to the queue e.g. /app1/myframe/test1
29
+ # means http://localhost:5884/app1/myframe/test1
30
+ # this parameter is not optional
31
+ q.path = "/fmq_test/test1"
32
+ # this defines the maximum count of messages that
33
+ # can be in the queue, if the queue is full every
34
+ # new message will be rejected with a http error
35
+ # this parameter is optional if you don't specify
36
+ # a max value the queue size depends on your system
37
+ q.max_messages = 1000000
38
+ # this optional to and specifys the max content size
39
+ # for all data of a queue
40
+ # valid extensions are kb, mb, gb
41
+ q.max_size = "10kb"
42
+ end
43
+
44
+ # if you want you can specify the class of the queue
45
+ # this is interessting if you write your own queues
46
+ qm.setup_queue FreeMessageQueue::LoadBalancedQueue do |q|
47
+ q.path = "/fmq_test/test2"
48
+ end
49
+
50
+ # if you have special queues include put them into the queues
51
+ # folder and and use them (this MyTestQueue is places in queues/mytest.rb)
52
+ qm.setup_queue MyTestQueue do |q|
53
+ q.path = "/fmq_test/test3"
54
+ end
55
+
56
+ # this is a forwarding queue wich forwards one message
57
+ # to some other queues
58
+ qm.setup_queue FreeMessageQueue::ForwardQueue do |q|
59
+ q.path = "/fmq_test/forward_to_1_and_2"
60
+ # you can add as may queues as you want
61
+ # but seperate them with a space char
62
+ q.forward_to = ["/fmq_test/test1", "/fmq_test/test2"]
63
+ end
64
+ end
65
+
66
+ # =====================================================
67
+ # setup the ajax admin interface
68
+ # =====================================================
69
+
70
+ # handle requests to remove, create, update queues
71
+ map "/admin/backend" do
72
+ run FreeMessageQueue::AdminInterface.new(queue_manager)
73
+ end
74
+
75
+ # serve static files in admin-interface folder
76
+ map "/admin" do
77
+ run Rack::File.new("./admin-interface")
78
+ end
79
+
80
+ # =====================================================
81
+ # install the server for the queue maneger
82
+ # =====================================================
83
+
84
+ map "/" do
85
+ run FreeMessageQueue::Server.new(queue_manager)
86
+ end