[ANN] Stomp Client Release

B

Brian McCallister

Stomp is a text-oriented wire protocol for messaging (MOM/MQ/JMS)
type systems. This library provides two useful interfaces, a low-
level class, Stomp::Connection, which is a basic protocol
implementation, and Stomp::Client, which is designed as a higher
level convenience API. More information is available at http://
stomp.codehaus.org/

This library is a client for the Stomp protocol. A couple servers
exist, the most mature probably being ActiveMQ ( http://
activemq.codehaus.org ) and Gozirra ( http://www.germane-software.com/
software/Java/Gozirra/ ).

While this release is labeled 1.0.0, it is not highly tested yet, so
bug reports are much appreciated!

-Brian

Installation via gems:
$ gem install stomp

Some sample code:

#!/usr/bin/env ruby -w
require 'rubygems'
require 'stomp'

# username, password, host, port
c = Stomp::Client.open "brianm", "s3kr3t", "localhost", 61613

# block will be called for each message received from the destination
c.subscribe "/queue/sample" do |message|
puts "received: #{message.body} on #{message.headers['destination']}"
end

# send a bunch of stuff (which we will receive)
for i in 1..5 do
c.send "/queue/sample", "Hello world #{i}!"
end

# wait (not very long) for delivery
gets

# done!
c.close
 
J

Jim Freeze

This looks pretty cool. (dumb question ahead) How is it different than
using DRb?

I was planning on writing a quick client server with drb that managed
a resource pool. Would using stomp be a better way to go?

Thanks

Stomp is a text-oriented wire protocol for messaging (MOM/MQ/JMS)
type systems. This library provides two useful interfaces, a low-
level class, Stomp::Connection, which is a basic protocol
implementation, and Stomp::Client, which is designed as a higher
level convenience API. More information is available at http://
stomp.codehaus.org/

This library is a client for the Stomp protocol. A couple servers
exist, the most mature probably being ActiveMQ ( http://
activemq.codehaus.org ) and Gozirra ( http://www.germane-software.com/
software/Java/Gozirra/ ).

While this release is labeled 1.0.0, it is not highly tested yet, so
bug reports are much appreciated!

-Brian

Installation via gems:
$ gem install stomp

Some sample code:

#!/usr/bin/env ruby -w
require 'rubygems'
require 'stomp'

# username, password, host, port
c =3D Stomp::Client.open "brianm", "s3kr3t", "localhost", 61613

# block will be called for each message received from the destination
c.subscribe "/queue/sample" do |message|
puts "received: #{message.body} on #{message.headers['destination']}"
end

# send a bunch of stuff (which we will receive)
for i in 1..5 do
c.send "/queue/sample", "Hello world #{i}!"
end

# wait (not very long) for delivery
gets

# done!
c.close
 
B

Brian McCallister

This looks pretty cool. (dumb question ahead) How is it different than
using DRb?

I was planning on writing a quick client server with drb that managed
a resource pool. Would using stomp be a better way to go?

DRb is a synchronous RPC style system whereas stomp is asynchronous
message passing (though you can ask for a reply). If you need call/
response style semantics in a synchronous way drb will probably be
much better for you.

A brief intro to MOM: http://rubyurl.com/J2l

In terms of what to use: if it is all ruby <--> communication, and is
synchronous in nature, and you don't have multiple consumers for
messages, DRb is the way to go, if it is multi-language,
asynchronous, or you need multiple consumers for messages, MOM
(possibly using stomp for interop) is generally better =)

-Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top