Path: | README.rdoc |
Last Update: | Tue Feb 11 12:01:19 -0800 2014 |
An implementation of the Stomp protocol for Ruby. See:
See _CHANGELOG.rdoc_ for details.
hash = { :hosts => [ # First connect is to remotehost1 {:login => "login1", :passcode => "passcode1", :host => "remotehost1", :port => 61612, :ssl => true}, # First failover connect is to remotehost2 {:login => "login2", :passcode => "passcode2", :host => "remotehost2", :port => 61613, :ssl => false}, ], # These are the default parameters and do not need to be set :reliable => true, # reliable (use failover) :initial_reconnect_delay => 0.01, # initial delay before reconnect (secs) :max_reconnect_delay => 30.0, # max delay before reconnect :use_exponential_back_off => true, # increase delay between reconnect attpempts :back_off_multiplier => 2, # next delay multiplier :max_reconnect_attempts => 0, # retry forever, use # for maximum attempts :randomize => false, # do not radomize hosts hash before reconnect :connect_timeout => 0, # Timeout for TCP/TLS connects, use # for max seconds :connect_headers => {}, # user supplied CONNECT headers (req'd for Stomp 1.1+) :parse_timeout => 5, # receive / read timeout, secs :logger => nil, # user suplied callback logger instance :dmh => false, # do not support multihomed IPV4 / IPV6 hosts during failover :closed_check => true, # check first if closed in each protocol method :hbser => false, # raise on heartbeat send exception :stompconn => false, # Use STOMP instead of CONNECT :usecrlf => false, # Use CRLF command and header line ends (1.2+) :max_hbread_fails => 0, # Max HB read fails before retry. 0 => never retry :max_hbrlck_fails => 0, # Max HB read lock obtain fails before retry. 0 => never retry } # for client client = Stomp::Client.new(hash) # for connection connection = Stomp::Connection.new(hash)
client = Stomp::Client.new("user", "pass", "localhost", 61613) client.publish("/queue/mine", "hello world!") client.subscribe("/queue/mine") do |msg| p msg end
# Stomp URL : A Stomp URL must begin with 'stomp://' and can be in one of the following forms: stomp://host:port stomp://host.domain.tld:port stomp://login:passcode@host:port stomp://login:passcode@host.domain.tld:port e.g. c = Stomp::Client.new(urlstring)
options = "initialReconnectDelay=5000&randomize=false&useExponentialBackOff=false" # remotehost1 uses SSL, remotehost2 doesn't client = Stomp::Client.new("failover:(stomp+ssl://login1:passcode1@remotehost1:61612,stomp://login2:passcode2@remotehost2:61613)?#{options}") client.publish("/queue/mine", "hello world!") client.subscribe("/queue/mine") do |msg| p msg end
Up until March 2009 the project was maintained and primarily developed by Brian McCallister.
https://github.com/stompgem/stomp/
http://stomp.github.com/index.html
The following people have contributed to Stomp: