qup 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/{ADAPTER_API.rdoc → ADAPTER_API.md} +0 -0
- data/CONTRIBUTING.md +46 -0
- data/{HISTORY.rdoc → HISTORY.md} +21 -12
- data/LICENSE +16 -0
- data/Manifest.txt +7 -3
- data/README.md +167 -0
- data/Rakefile +8 -291
- data/lib/qup.rb +1 -1
- data/lib/qup/adapter/kestrel/queue.rb +6 -0
- data/lib/qup/adapter/kestrel/topic.rb +31 -9
- data/lib/qup/adapter/maildir/queue.rb +2 -0
- data/lib/qup/adapter/maildir/topic.rb +18 -5
- data/lib/qup/adapter/redis/topic.rb +23 -4
- data/spec/qup/shared_adapter_examples.rb +2 -0
- data/spec/qup/shared_topic_examples.rb +16 -4
- data/tasks/default.rake +269 -0
- data/tasks/this.rb +209 -0
- metadata +110 -128
- data/README.rdoc +0 -167
data/README.rdoc
DELETED
@@ -1,167 +0,0 @@
|
|
1
|
-
= qup - Queue Up
|
2
|
-
|
3
|
-
* http://github.com/copiousfreetime/qup
|
4
|
-
|
5
|
-
== DESCRIPTION
|
6
|
-
|
7
|
-
Qup is a generalized API for Message Queue and Publish/Subscribe messaging
|
8
|
-
patterns with the ability to plug in an appropriate messaging infrastructure
|
9
|
-
based upon your needs.
|
10
|
-
|
11
|
-
Qup ships with support for {Kestrel}[https://github.com/robey/kestrel],
|
12
|
-
{Redis}[http://redis.io], and a filesystem infrastructure based on
|
13
|
-
{Maildir}[https://rubygems.org/gems/maildir]. Additional Adapters will be
|
14
|
-
developed as needs arise. {Please submit an
|
15
|
-
Issue}[https://github.com/copiousfreetime/qup/issues] to have a new Adapter
|
16
|
-
created. Pull requests gladly accepted.
|
17
|
-
|
18
|
-
== FEATURES
|
19
|
-
|
20
|
-
Qup provides an abstract implementation of two common messaging patterns.
|
21
|
-
|
22
|
-
[Basic Message Queue]
|
23
|
-
|
24
|
-
Examples of a basic message queue are {Work/Task
|
25
|
-
Queues}[http://www.rabbitmq.com/tutorials/tutorial-two-python.html], {JMS
|
26
|
-
Queue}[http://docs.oracle.com/javaee/6/api/javax/jms/Queue.html], or {Amazon
|
27
|
-
SQS}[http://aws.amazon.com/sqs/]. This is a pattern where one or more
|
28
|
-
Producers puts Messages on a Queue and one or more Consumers received those
|
29
|
-
Messages. Each Message is delivered only 1 time to a Consumer.
|
30
|
-
|
31
|
-
[Publish/Subscribe]
|
32
|
-
|
33
|
-
{Wikipedia Article on Pub/Sub
|
34
|
-
pattern}[http://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern].
|
35
|
-
|
36
|
-
Qup implements a Topic based system, where Publishers send Messages on a Topic
|
37
|
-
and all Subscribers to that topic each receive their own copy of the message.
|
38
|
-
|
39
|
-
Qup assumes that the messaging systems it has adapters for provided durable and
|
40
|
-
acknowledgeable messaging.
|
41
|
-
|
42
|
-
[Durability]
|
43
|
-
|
44
|
-
When message is sent to the messaging system by Qup, the message is persisted to
|
45
|
-
disk.
|
46
|
-
|
47
|
-
[Acknowledgeable Messages]
|
48
|
-
|
49
|
-
When a Consumer receives a Message, and then processes it, Qup assumes that
|
50
|
-
the messaging infrastructure requires that the Message be positively
|
51
|
-
acknowledged. In other words, if the Consumer does not acknowledge the message
|
52
|
-
then the messages infrastructure will put the Message back onto the Queue.
|
53
|
-
|
54
|
-
== SYNOPSIS
|
55
|
-
|
56
|
-
=== Basic Message Queue
|
57
|
-
|
58
|
-
session = Qup::Session.new( "maildir:///tmp/test-queue" )
|
59
|
-
queue = session.queue( 'basic-messaging' )
|
60
|
-
producer = queue.producer
|
61
|
-
|
62
|
-
consumer_1 = queue.consumer
|
63
|
-
consumer_2 = queue.consumer
|
64
|
-
|
65
|
-
producer.produce( 'message_1' )
|
66
|
-
producer.produce( 'message_2' )
|
67
|
-
|
68
|
-
message_1 = consumer_1.consume
|
69
|
-
puts message_1.data # => 'message_1'
|
70
|
-
consumer_1.acknowledge( message_1 )
|
71
|
-
|
72
|
-
consumer_2.consume do |message_2|
|
73
|
-
puts message_2.data # => 'message_2'
|
74
|
-
end # auto acknowledged at the end of the block
|
75
|
-
|
76
|
-
=== Publish/Subscribe
|
77
|
-
|
78
|
-
session = Qup::Session.new( "kestrel://messaging.example.com:22133" )
|
79
|
-
topic = session.topic( 'topic-messaging' )
|
80
|
-
publisher = topic.publisher
|
81
|
-
|
82
|
-
subscribers = []
|
83
|
-
3.times do |n|
|
84
|
-
subscribers << topic.subscriber( "subscriber-#{n}" )
|
85
|
-
end
|
86
|
-
|
87
|
-
publisher.publish( 'a fine message on a topic' )
|
88
|
-
|
89
|
-
subscribers.each do |sub|
|
90
|
-
sub.consume do |msg|
|
91
|
-
puts msg.data # => 'a fine message on a topic'
|
92
|
-
end # auto acknowledge an end of block
|
93
|
-
end
|
94
|
-
|
95
|
-
== REQUIREMENTS
|
96
|
-
|
97
|
-
Depending on the backend messaging system you want to use, you'll need to
|
98
|
-
install additional gems. At the current moment, these are the supported
|
99
|
-
messaging backends.
|
100
|
-
|
101
|
-
* Qup::Adapter::Maildir - built in and uses the 'maildir' gem
|
102
|
-
* Qup::Adapter::Kestrel - uses the 'kjess' gem
|
103
|
-
* Qup::Adapter::Redis - uses the 'redis' gem
|
104
|
-
|
105
|
-
== INSTALL
|
106
|
-
|
107
|
-
* gem install qup
|
108
|
-
|
109
|
-
== DEVELOPERS
|
110
|
-
|
111
|
-
After checking out the source, run:
|
112
|
-
|
113
|
-
$ rake develop
|
114
|
-
|
115
|
-
This task will install any missing dependencies. You may then run:
|
116
|
-
|
117
|
-
$ rake test
|
118
|
-
|
119
|
-
Other tasks are viewable with
|
120
|
-
|
121
|
-
$ rake -T
|
122
|
-
|
123
|
-
=== Kestrel
|
124
|
-
|
125
|
-
To run the Kestrel tests you will need:
|
126
|
-
|
127
|
-
* gem install kjess
|
128
|
-
* A Kestrel server running on <tt>localhost:22133</tt>
|
129
|
-
|
130
|
-
You can download Kestrel from http://robey.github.com/kestrel/ and then run the
|
131
|
-
+scripts/devel.sh+ command and you will have a default Kestrel server running on
|
132
|
-
<tt>localhost:22133</tt>. This will be enough to run the kestrel tests.
|
133
|
-
|
134
|
-
=== Redis
|
135
|
-
|
136
|
-
To run the Redis tests you will need:
|
137
|
-
|
138
|
-
* gem install redis
|
139
|
-
* A Redis server running on <tt>localhost:6479</tt>
|
140
|
-
|
141
|
-
You can download redis using brew, macports or your favorite linux package
|
142
|
-
manager.
|
143
|
-
|
144
|
-
== LICENSE
|
145
|
-
|
146
|
-
(The ISC LICENSE)
|
147
|
-
|
148
|
-
Copyright (c) 2012 Jeremy Hinegardner
|
149
|
-
|
150
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
151
|
-
a copy of this software and associated documentation files (the
|
152
|
-
'Software'), to deal in the Software without restriction, including
|
153
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
154
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
155
|
-
permit persons to whom the Software is furnished to do so, subject to
|
156
|
-
the following conditions:
|
157
|
-
|
158
|
-
The above copyright notice and this permission notice shall be
|
159
|
-
included in all copies or substantial portions of the Software.
|
160
|
-
|
161
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
162
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
163
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
164
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
165
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
166
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
167
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|