Qup-1.2.0 - API for Message Queue and Pub/Sub messaging

I’d like to announce the first public release of qup, generalized API
Message Queue and Publish/Subscribe messaging patterns with the ability
to plug
in an appropriate messaging infrastructure based upon your needs.

Qup ships with support for Kestrel, Redis, and a filesystem
based on Maildir. Additional Adapters will be developed as needs arise.
submit an Issue (Issues · copiousfreetime/qup · GitHub) to have
a new
Adapter created. Pull requests gladly accepted. Instructions on how to
write an
Adapter are provided:



Qup provides an abstract implementation of two common messaging

  1. Basic Message Queue

Examples of the basic message queue concept are:

* Work/Task Queues - 

* JMS Queue -
* Amazon SQS - Fully Managed Message Queuing – Amazon Simple Queue Service – Amazon Web Services

This is a pattern where one or more Producers puts Messages on a Queue
one or more Consumers received those Messages. Each Message is
delivered only 1
time to a Consumer.

  1. Publish/Subscribe

Publish–subscribe pattern - Wikipedia

Qup implements a Topic based system, where Publishers send Messages on
a Topic
and all Subscribers to that topic each receive their own copy of the

Qup assumes that the messaging systems it has adapters for provided
durable and
acknowledgeable messaging.


When message is sent to the messaging system by Qup, the message is
persisted to

[Acknowledgeable Messages]

When a Consumer receives a Message, and then processes it, Qup assumes
the messaging infrastructure requires that the Message be positively
acknowledged. In other words, if the Consumer does not acknowledge the
then the messages infrastructure will put the Message back onto the

=== Basic Message Queue

session = Qup::Session.new( “maildir:///tmp/test-queue” )
queue = session.queue( ‘basic-messaging’ )
producer = queue.producer

consumer_1 = queue.consumer
consumer_2 = queue.consumer

producer.produce( ‘message_1’ )
producer.produce( ‘message_2’ )

message_1 = consumer_1.consume
puts message_1.data # => ‘message_1’
consumer_1.acknowledge( message_1 )

consumer_2.consume do |message_2|
puts message_2.data # => ‘message_2’
end # auto acknowledged at the end of the block

=== Publish/Subscribe

session = Qup::Session.new( “kestrel://messaging.example.com:22133”
topic = session.topic( ‘topic-messaging’ )
publisher = topic.publisher

subscribers = []
3.times do |n|
subscribers << topic.subscriber( “subscriber-#{n}” )

publisher.publish( ‘a fine message on a topic’ )

subscribers.each do |sub|
sub.consume do |msg|
puts msg.data # => ‘a fine message on a topic’
end # auto acknowledge an end of block