stompserver_ng 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. data/History.txt +159 -0
  2. data/Manifest.txt +71 -0
  3. data/README.txt +172 -0
  4. data/Rakefile +38 -0
  5. data/STATUS +5 -0
  6. data/bin/stompserver_ng +63 -0
  7. data/client/README.txt +1 -0
  8. data/client/both.rb +25 -0
  9. data/client/consume.rb +14 -0
  10. data/client/send.rb +17 -0
  11. data/config/stompserver_ng.conf +11 -0
  12. data/etc/19xcompat/notes.txt +223 -0
  13. data/etc/arutils/README-activerecord.txt +78 -0
  14. data/etc/arutils/cre_mysql.rb +34 -0
  15. data/etc/arutils/cre_postgres.rb +33 -0
  16. data/etc/arutils/cre_sqlite3.rb +28 -0
  17. data/etc/arutils/mysql_boot.sql +12 -0
  18. data/etc/arutils/postgres_boot.sql +14 -0
  19. data/etc/database.mysql.yml +9 -0
  20. data/etc/database.postgres.yml +9 -0
  21. data/etc/passwd.example +3 -0
  22. data/etc/ppqinfo.rb +15 -0
  23. data/etc/runserver.sh +17 -0
  24. data/etc/stompserver_ng +50 -0
  25. data/etc/stompserver_ng.conf +13 -0
  26. data/lib/stomp_server_ng.rb +471 -0
  27. data/lib/stomp_server_ng/protocols/http.rb +128 -0
  28. data/lib/stomp_server_ng/protocols/stomp.rb +407 -0
  29. data/lib/stomp_server_ng/qmonitor.rb +58 -0
  30. data/lib/stomp_server_ng/queue.rb +248 -0
  31. data/lib/stomp_server_ng/queue/activerecord_queue.rb +118 -0
  32. data/lib/stomp_server_ng/queue/ar_message.rb +21 -0
  33. data/lib/stomp_server_ng/queue/ar_reconnect.rb +18 -0
  34. data/lib/stomp_server_ng/queue/dbm_queue.rb +72 -0
  35. data/lib/stomp_server_ng/queue/file_queue.rb +56 -0
  36. data/lib/stomp_server_ng/queue/memory_queue.rb +64 -0
  37. data/lib/stomp_server_ng/queue_manager.rb +302 -0
  38. data/lib/stomp_server_ng/stomp_auth.rb +26 -0
  39. data/lib/stomp_server_ng/stomp_frame.rb +32 -0
  40. data/lib/stomp_server_ng/stomp_frame_recognizer.rb +77 -0
  41. data/lib/stomp_server_ng/stomp_id.rb +32 -0
  42. data/lib/stomp_server_ng/stomp_user.rb +17 -0
  43. data/lib/stomp_server_ng/test_server.rb +21 -0
  44. data/lib/stomp_server_ng/topic_manager.rb +46 -0
  45. data/setup.rb +1585 -0
  46. data/stompserver_ng.gemspec +136 -0
  47. data/test/devserver/props.yaml +5 -0
  48. data/test/devserver/runserver.sh +16 -0
  49. data/test/devserver/stompserver_ng.dbm.conf +12 -0
  50. data/test/devserver/stompserver_ng.file.conf +12 -0
  51. data/test/devserver/stompserver_ng.memory.conf +12 -0
  52. data/test/noserver/mocklogger.rb +12 -0
  53. data/test/noserver/test_queue_manager.rb +134 -0
  54. data/test/noserver/test_stomp_frame.rb +138 -0
  55. data/test/noserver/test_topic_manager.rb +79 -0
  56. data/test/noserver/ts_all_no_server.rb +12 -0
  57. data/test/props.yaml +5 -0
  58. data/test/runalltests.sh +14 -0
  59. data/test/runtest.sh +4 -0
  60. data/test/test_0000_base.rb +107 -0
  61. data/test/test_0001_conn.rb +47 -0
  62. data/test/test_0002_conn_sr.rb +94 -0
  63. data/test/test_0006_client.rb +41 -0
  64. data/test/test_0011_send_recv.rb +74 -0
  65. data/test/test_0015_ack_conn.rb +78 -0
  66. data/test/test_0017_ack_client.rb +78 -0
  67. data/test/test_0019_ack_no_ack.rb +145 -0
  68. data/test/test_0022_ack_noack_conn.rb +123 -0
  69. data/test/test_0030_subscr_id.rb +44 -0
  70. data/test/test_0040_receipt_conn.rb +87 -0
  71. data/test/ts_all_server.rb +10 -0
  72. metadata +196 -0
@@ -0,0 +1,159 @@
1
+ == 1.0.6 / 21 Apr 2011
2
+
3
+ * Change tests to use 'publish' not 'send'
4
+ * Fix broken tests under Ruby 1.9.1p180
5
+ * Handle subscriptions when 'id' header is specified
6
+
7
+ == 1.0.5 / 14 Mar 2011
8
+
9
+ * Correct exception during unsubscribe
10
+ * Replace 'hoe' with 'jeweler'
11
+
12
+ == 1.0.4 / 24 Dec 2010
13
+
14
+ * Use EM::epoll if available
15
+ * Refactor, remove unused methods
16
+ * Refactor, move recognizer and monitor to separate files
17
+ * Use hanna style docs only if hanna is present
18
+ * Smoke tested under Ruby 1.9.2p80 (2010-12-02 revision 30049) [i686-linux]
19
+
20
+ == 1.0.3 / 01 Jun 2010
21
+
22
+ * Add tested support for activerecord message stores with examples.
23
+ * Limit log message size for 'large' messages.
24
+ * Clarify some documentation.
25
+ * Add more publish / receive tests, remove duplicate tests.
26
+ * Update manifest with new file names.
27
+ * Update gemspec with new file names.
28
+
29
+ == 1.0.2 / 14 May 2010
30
+
31
+ * Continue to fix incompatabilities uncovered with gem rename.
32
+ * Add session IDs to all log messages.
33
+ * Remove some duplicate tests.
34
+
35
+ == 1.0.1 / 25 Apr 2010
36
+
37
+ * Ensure stompserver_ng and the older stompserver gems can coexist.
38
+
39
+ == 1.0.0 / 24 Apr 2010
40
+
41
+ * Rename the ruby gem.
42
+ * Start new versioning methodology.
43
+
44
+ == 0.9.9.2010.01.15.00 / 15 Jan 2010
45
+
46
+ * Refactor and correct tests.
47
+ * Correct lead sequence of config files.
48
+ * Fix send receipt sequencing bug
49
+ * Fix exceptions with no config file command line overide
50
+ * Fix problems with sysvinit script
51
+ * Change some messages to warn level
52
+
53
+ == 0.9.9.2010.01.08.00 / 08 Jan 2010
54
+
55
+ * Override server and/or port from tests.
56
+ * Fix one more 1.9 compatability issue during shutdown.
57
+ * Fix counts reported by monitor with ack => client.
58
+
59
+ == 0.9.9.2010.01.02.00 / 02 Jan 2010
60
+
61
+ * Fix server crashes when no ACK received.
62
+ * Tests for same.
63
+ * Handle SIGTERM.
64
+
65
+ == 0.9.9.2010.01.01.00 / 01 Jan 2010
66
+
67
+ * Some fixes for 'ack' => 'client' processing. The first step down this road.
68
+ * Tests for same. Tests are intermittently unstable due to previously unseen problems.
69
+ * Some fixes around session ID cache handling.
70
+ * Cleaner creation of the .pid file at startup.
71
+ * Sample sysvinit boot scripts - very primitive.
72
+
73
+ == 0.9.9.2009.12.27.00 / 27 Dec 2009
74
+
75
+ * Add session ID management
76
+ * Refactor stomp protocol class code
77
+
78
+ == 0.9.9.2009.12.25.00 / 25 Dec 2009
79
+
80
+ * Consolidate start messaging to a single class
81
+ * Log all runtime values
82
+ * Eliminate r19 subdirectory artifacts
83
+ * Remove -d / --debug as the default for the test server
84
+ * Remove references to $DEBUG in the protocol handler
85
+
86
+ == 0.9.9.2009.12.21.00 / 21 Dec 2009
87
+
88
+ * Fix 1.9.0 compatability issues
89
+ * Event machine dependency is 0.12.0
90
+ * Fix mismatches between command line and configuration file parameters
91
+
92
+ == 0.9.9.2009121900 / 19 Dec 2009
93
+
94
+ * Ruby 1.9 compatability
95
+ * Use standard ruby logger instead of puts
96
+
97
+ == 0.9.9 / 31 Jan 2008
98
+
99
+ * Fix for non-memory backends with empty queues
100
+ * Fix for queue monitoring
101
+ * Use atomic checkpoint, write to a new file and then rename it into
102
+ place to avoid incomplete qinfo files being written
103
+ * add configuration parameter for checkpoint time for better performance
104
+ with large queues
105
+
106
+ == 0.9.8 / 16 Aug 2007
107
+
108
+ * Several storage backends instead of Madeleine (allow tradeoffs between
109
+ robustness with ActiveRecord and speed with memory with intermediary
110
+ solutions based on file or dbm storages).
111
+ * Better load distribution between clients acknowledging messages after
112
+ processing them.
113
+ * Monitoring support through a dedicated queue.
114
+
115
+ == 0.9.5 / 18 Oct 2006
116
+
117
+ * Removed eventmachine dependency in the gem
118
+ you still need eventmachine, but you can choose between
119
+ eventmachine and eventmachine-win32, not sure how to put
120
+ that in the gem.
121
+
122
+ Also made another minor fix to the stompserver binary.
123
+
124
+ == 0.9.4 / 17 Oct 2006
125
+
126
+ * Cleanup (wow I was tired last night)
127
+ * Tested under Linux, added require 'rubygems'
128
+ * Fixed stompserver binary - it now works and takes a few simple command args
129
+ * Fixed up minor (tesly) test syntax issues
130
+
131
+ == 0.9.3 / 16 Oct 2006
132
+
133
+ * Last one tonight I promise
134
+ * Fixed incorrect gem requirement version on eventmachine
135
+ * Fixed stompserver cmd added by gem
136
+
137
+ == 0.9.2 / 16 Oct 2006
138
+
139
+ * More Queue issues resolved
140
+ * Added more unit tests
141
+ * All tests pass
142
+ * Queue processing done in one large batch, this may change
143
+
144
+ == 0.9.1 / 16 Oct 2006
145
+
146
+ * Stepping along
147
+ * Fixed release issues
148
+ * Fixed queue logic error (failed to detect offlines)
149
+
150
+ == 0.9.0 / 16 Oct 2006
151
+
152
+ * Initialial Beta Release
153
+ * Seems to work
154
+ * Passes numerous test cases
155
+ * Journals using madeleine
156
+ * Needs documentaion
157
+ * Needs to command line processing
158
+ * Needs service/daemon options4
159
+
@@ -0,0 +1,71 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ STATUS
6
+ bin/stompserver_ng
7
+ client/README.txt
8
+ client/both.rb
9
+ client/consume.rb
10
+ client/send.rb
11
+ config/stompserver_ng.conf
12
+ etc/19xcompat/notes.txt
13
+ etc/arutils/README-activerecord.txt
14
+ etc/arutils/cre_mysql.rb
15
+ etc/arutils/cre_postgres.rb
16
+ etc/arutils/cre_sqlite3.rb
17
+ etc/arutils/mysql_boot.sql
18
+ etc/arutils/postgres_boot.sql
19
+ etc/database.mysql.yml
20
+ etc/database.postgres.yml
21
+ etc/passwd.example
22
+ etc/ppqinfo.rb
23
+ etc/runserver.sh
24
+ etc/stompserver_ng
25
+ etc/stompserver_ng.conf
26
+ lib/stomp_server_ng.rb
27
+ lib/stomp_server_ng/protocols/http.rb
28
+ lib/stomp_server_ng/protocols/stomp.rb
29
+ lib/stomp_server_ng/qmonitor.rb
30
+ lib/stomp_server_ng/queue.rb
31
+ lib/stomp_server_ng/queue/activerecord_queue.rb
32
+ lib/stomp_server_ng/queue/ar_message.rb
33
+ lib/stomp_server_ng/queue/ar_reconnect.rb
34
+ lib/stomp_server_ng/queue/dbm_queue.rb
35
+ lib/stomp_server_ng/queue/file_queue.rb
36
+ lib/stomp_server_ng/queue/memory_queue.rb
37
+ lib/stomp_server_ng/queue_manager.rb
38
+ lib/stomp_server_ng/stomp_auth.rb
39
+ lib/stomp_server_ng/stomp_frame.rb
40
+ lib/stomp_server_ng/stomp_frame_recognizer.rb
41
+ lib/stomp_server_ng/stomp_id.rb
42
+ lib/stomp_server_ng/stomp_user.rb
43
+ lib/stomp_server_ng/test_server.rb
44
+ lib/stomp_server_ng/topic_manager.rb
45
+ setup.rb
46
+ stompserver_ng.gemspec
47
+ test/devserver/props.yaml
48
+ test/devserver/runserver.sh
49
+ test/devserver/stompserver_ng.dbm.conf
50
+ test/devserver/stompserver_ng.file.conf
51
+ test/devserver/stompserver_ng.memory.conf
52
+ test/noserver/mocklogger.rb
53
+ test/noserver/test_queue_manager.rb
54
+ test/noserver/test_stomp_frame.rb
55
+ test/noserver/test_topic_manager.rb
56
+ test/noserver/ts_all_no_server.rb
57
+ test/props.yaml
58
+ test/runalltests.sh
59
+ test/runtest.sh
60
+ test/test_0000_base.rb
61
+ test/test_0001_conn.rb
62
+ test/test_0002_conn_sr.rb
63
+ test/test_0006_client.rb
64
+ test/test_0011_send_recv.rb
65
+ test/test_0015_ack_conn.rb
66
+ test/test_0017_ack_client.rb
67
+ test/test_0019_ack_no_ack.rb
68
+ test/test_0022_ack_noack_conn.rb
69
+ test/test_0030_subscr_id.rb
70
+ test/test_0040_receipt_conn.rb
71
+ test/ts_all_server.rb
@@ -0,0 +1,172 @@
1
+ == DESCRIPTION:
2
+
3
+ Stomp messaging server with file/dbm/memory/activerecord based FIFO
4
+ queues, queue monitoring, and basic authentication.
5
+
6
+ == SYNOPSYS:
7
+
8
+ Handles basic message queue processing
9
+
10
+ == REQUIREMENTS:
11
+
12
+ * EventMachine
13
+
14
+ == FEATURES/PROBLEMS:
15
+
16
+ === Several queue storage backends
17
+
18
+ Handles basic message queue processing using memory, file, or dbm
19
+ based queues. Messages are sent and consumed in FIFO order (unless a
20
+ client error happens, this should be corrected in the future). Topics
21
+ are memory-only storage. You can select activerecord, file or dbm
22
+ storage and the queues will use that, but topics will only be stored
23
+ in memory.
24
+
25
+ memory queues are of course the fastest ones but shouldn't be used if
26
+ you want to ensure all messages are delivered.
27
+
28
+ dbm queues will use berkeleydb if available, otherwise dbm or gdbm
29
+ depending on the platform. sdbm does not work well with marshalled
30
+ data. Note that these queues have not been tested in this release.
31
+
32
+ For the file based storage, each frame is stored in a single file. The
33
+ first 8 bytes contains the header length, the next 8 bytes contains
34
+ the body length, then the headers are stored as a marshalled object
35
+ followed by the body stored as a string. This storage is currently
36
+ inefficient because queues are stored separately from messages, which
37
+ forces a double write for data safety reasons on each message stored.
38
+
39
+ The activerecord based storage expects to find a database.yml file in
40
+ the configuration directory. It should be the most robust backend, but
41
+ the slowest one. The database must have an ar_messages table which can
42
+ be created with the following code (you are responsible to do so):
43
+
44
+ ActiveRecord::Schema.define do
45
+ create_table 'ar_messages' do |t|
46
+ t.column 'stomp_id', :string, :null => false
47
+ t.column 'frame', :text, :null => false
48
+ end
49
+ end
50
+
51
+ You can read the frames with this model:
52
+
53
+ class ArMessage < ActiveRecord::Base
54
+ serialize :frame
55
+ end
56
+
57
+ The ar_message implementation will certainly change in the future.
58
+
59
+ This is meant to be easily readable by a Rails application (which
60
+ could handle the ar_messages table creation with a migration).
61
+
62
+ === Limitations
63
+
64
+ Stompserver not support any server to server messaging (although you could
65
+ write a client to do this).
66
+
67
+ === Monitoring
68
+
69
+ Queues can be monitored via the monitor queue (this will probably not
70
+ be supported this way in the future to avoid polluting the queue
71
+ namespace). If you subscribe to /queue/monitor, you will receive a
72
+ status message every 5 seconds that displays each queue, it's size,
73
+ frames enqueued, and frames dequeued. Stats are sent in the same
74
+ format of stomp headers, so they are easy to parse. Following is an
75
+ example of a status message containing stats for 2 queues:
76
+
77
+ Queue: /queue/client2
78
+ size: 0
79
+ dequeued: 400
80
+ enqueued: 400
81
+
82
+ Queue: /queue/test
83
+ size: 50
84
+ dequeued: 250
85
+ enqueued: 300
86
+
87
+ === Access control
88
+
89
+ Basic client authorization is also supported. If the -a flag is
90
+ passed to stompserver_ng on startup, and a .passwd file exists in the run
91
+ directory, then clients will be required to provide a valid login and
92
+ passcode. See passwd.example for the password file format.
93
+
94
+ === Misc
95
+
96
+ Whenever you stop the server, any queues with no messages will be
97
+ removed, and the stats for that queue will be reset. If the queue has
98
+ any messages remaining then the stats will be saved and available on
99
+ the next restart.
100
+
101
+ == INSTALL:
102
+
103
+ * gem install stompserver_ng
104
+
105
+ stompserver_ng will create a log, etc, and storage directory on startup
106
+ in your current working directory, the value passed to as
107
+ --working_dir parameter, or if using a config file it will
108
+ use what you specified for working_dir. The configuration file is a
109
+ yaml file and can be specified on the command line with -C
110
+ <configfile>. A sample is provided in config/stompserver.conf.
111
+
112
+ Command line options will override options set in the yaml config
113
+ file.
114
+
115
+ To use the memory queue run as follows:
116
+ stompserver_ng -p 61613 -b 0.0.0.0
117
+
118
+ To use the file or dbm queue storage, use the -q switch and specificy
119
+ either file or dbm. The file and dbm queues also take a storage
120
+ directory specified with -s. .stompserver is the default directory if
121
+ -s is not used.
122
+ stompserver_ng -p 61613 -b 0.0.0.0 -q file -s .stompfile
123
+ Or
124
+ stompserver_ng -p 61613 -b 0.0.0.0 -q dbm -s .stompbdb
125
+
126
+ To specify where the queue is stored on disk, use the -s flag followed
127
+ by a storage directory. To enable client authorization use -a, for
128
+ debugging use -d.
129
+ stompserver_ng -p 61613 -b 0.0.0.0 -q file -s .stompserver -a -d
130
+
131
+ You cannot use the same storage directory for a file and dbm queue,
132
+ they must be kept separate.
133
+
134
+ To use the activerecord queue storage use -q activerecord:
135
+ stompserver_ng -p 61613 -b 0.0.0.0 -q activerecord
136
+ It will try to read the etc/database.yml file in the working
137
+ directory. Here's an example of a database.yml for a PostgreSQL
138
+ database named stompserver on the 'dbserver' host usable by
139
+ PostgreSQL's user 'foo' with password 'bar'(see ActiveRecord's
140
+ documentation for the parameters needed by your database):
141
+
142
+ adapter: postgresql
143
+ database: stompserver
144
+ username: foo
145
+ password: bar
146
+ host: dbserver
147
+
148
+ == LICENSE:
149
+
150
+ (The MIT License)
151
+
152
+ Copyright (c) 2006 Patrick Hurley
153
+ Copyright (c) 2007 Lionel Bouton
154
+
155
+ Permission is hereby granted, free of charge, to any person obtaining
156
+ a copy of this software and associated documentation files (the
157
+ 'Software'), to deal in the Software without restriction, including
158
+ without limitation the rights to use, copy, modify, merge, publish,
159
+ distribute, sublicense, and/or sell copies of the Software, and to
160
+ permit persons to whom the Software is furnished to do so, subject to
161
+ the following conditions:
162
+
163
+ The above copyright notice and this permission notice shall be
164
+ included in all copies or substantial portions of the Software.
165
+
166
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
167
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
168
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
169
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
170
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
171
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
172
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,38 @@
1
+ # -*- ruby -*-
2
+ #
3
+ require 'rubygems'
4
+ $LOAD_PATH << "./lib"
5
+ require 'stomp_server_ng'
6
+ #
7
+ begin
8
+ require 'jeweler'
9
+ Jeweler::Tasks.new do |gem|
10
+ gem.name = "stompserver_ng"
11
+ gem.version = StompServer::VERSION
12
+ gem.summary = 'A very light messaging server, next generation'
13
+ gem.description = 'STOMP Next Generation Ruby server.'
14
+ gem.homepage = 'http://github.com/gmallard/stompserver_ng'
15
+ gem.authors = ["Patrick Hurley",
16
+ "Lionel Bouton",
17
+ "snacktime",
18
+ "gyver",
19
+ "Mike Mangino",
20
+ "robl",
21
+ "gmallard" ]
22
+ gem.email = ["phurley-blocked@rubyforge.org",
23
+ "lionel-dev@bouton.name",
24
+ "snacktime@somewhere.com",
25
+ "gyver@somewhere.com",
26
+ "mmangino-blocked@rubyforge.org",
27
+ "robl@monkeyhelper.com",
28
+ "allard.guy.m@gmail.com" ]
29
+ #
30
+ gem.add_dependency "daemons", ">= 1.0.10"
31
+ gem.add_dependency "eventmachine", ">= 0.12.10"
32
+ gem.add_dependency "uuid", ">= 2.1.0"
33
+ end
34
+ Jeweler::GemcutterTasks.new
35
+ rescue LoadError
36
+ puts "Jeweler not available. Install it with: gem install jeweler"
37
+ end
38
+
data/STATUS ADDED
@@ -0,0 +1,5 @@
1
+
2
+ - Unit tests are broken, need to override methods that call EM
3
+ - Added http protocol handler. No pipelining or anything fancy, just PUT/GET requests which enqueue/dequeue messages from
4
+ the queue one at a time. Uses the Mongrel http parser.
5
+