thiagoxvo / stomp

A ruby gem for sending and receiving messages from a Stomp protocol compliant message queue. Includes: failover logic, ssl support.

Home Page:http://stomp.github.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

README

Overview

An implementation of the Stomp protocol for Ruby. See:

Hash Login Example Usage (this is the recommended login technique):

hash = {
  hosts: [
    # First connect is to remotehost1
    { login: 'login1', passcode: 'passcode1', host: 'remotehost1', port: 61_612, ssl: true },
    # First failover connect is to remotehost2
    { login: 'login2', passcode: 'passcode2', host: 'remotehost2', port: 61_613, 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,                # IO::select wait time on socket reads
  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
  fast_hbs_adjust: 0.0,            # Fast heartbeat senders sleep adjustment, seconds, needed ...
  # For fast heartbeat senders.  'fast' == YMMV.  If not
  # correct for your environment, expect unnecessary fail overs
  connread_timeout: 0,             # Timeout during CONNECT for read of CONNECTED/ERROR, secs
  tcp_nodelay: true,               # Turns on the TCP_NODELAY socket option; disables Nagle's algorithm
  start_timeout: 0,                # Timeout around Stomp::Client initialization
  sslctx_newparm: nil,             # Param for SSLContext.new
  ssl_post_conn_check: true,       # Further verify broker identity
  nto_cmd_read: true,              # No timeout on COMMAND read
}

# for a client
client = Stomp::Client.new(hash)

# for a connection
connection = Stomp::Connection.new(hash)

Positional Parameter Usage:

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 Usage:

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)

Failover + SSL Example URL Usage:

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

New:

See CHANGELOG.rdoc for details.

  • Gem version 1.4.8. Fix missed merge in 1.4.7 release.
  • Gem version 1.4.7. Add support for text SSL certs. Do not use, use 1.4.8 instead.
  • Gem version 1.4.6. Fix version 1.4.5 which breaks JRuby support.
  • Gem version 1.4.5. JRuby broken here. Use is not recommended.
  • Gem version 1.4.4. Miscellaneous fixes, see CHANGELOG.md for details.
  • Gem version 1.4.3. Fix broken install. Do not try to install 1.4.2.
  • Gem version 1.4.2. Fix memory leak, and others !: see CHANGELOG.md for details.
  • Gem version 1.4.1. Important SSL changes !: see CHANGELOG.md for details.
  • Gem version 1.4.0. Note: Change sementics of :parse_timeout, see CHANGELOG.md for details.
  • Gem version 1.3.5. Miscellaneous fixes, see CHANGELOG.md for details.

For changes in older versions see CHANGELOG.rdoc for details.

Historical Information:

Up until March 2009 the project was maintained and primarily developed by Brian McCallister.

Source Code and Project URLs:

Source Code and Project

Stomp Protocol Information:

Protocol Information

Contributors (by first author date)

Contribution information:

First Author Date (Commit Count) Name / E-mail
2005-08-26 (0023) brianm / <brianm@fd4e7336-3dff-0310-b68a-b6615a75f13b>
2006-03-16 (0005) jstrachan / <jstrachan@fd4e7336-3dff-0310-b68a-b6615a75f13b>
2006-04-19 (0001) chirino / <chirino@fd4e7336-3dff-0310-b68a-b6615a75f13b>
2007-05-09 (0003) kookster / <kookster@fd4e7336-3dff-0310-b68a-b6615a75f13b>
2008-05-08 (0016) Glenn Rempe / <glenn@rempe.us>
2009-02-03 (0001) Tony Garnock-Jones / <tonyg@lshift.net>
2009-02-09 (0003) Marius Mathiesen / <marius.mathiesen@gmail.com>
2009-02-13 (0004) Johan Sørensen / <johan@johansorensen.com>
2009-11-17 (0019) Thiago Morello / <thiago.morello@locaweb.com.br>
2009-11-22 (0001) unknown / <katy@.(none)>
2009-12-18 (0047) Thiago Morello / <morello@queroinfra32.fabrica.locaweb.com.br>
2009-12-25 (0362) gmallard / <allard.guy.m@gmail.com>
2010-01-07 (0007) Rafael Rosa / <rafael.rosa@locaweb.com.br>
2010-03-23 (0092) Guy M. Allard / <allard.guy.m@gmail.com>
2010-04-01 (0001) Dmytro Shteflyuk / <kpumuk@kpumuk.info>
2010-10-22 (0001) Neil Wilson / <neil@aldur.co.uk>
2011-02-09 (0001) Dinesh Majrekar / <dinesh.majrekar@advantage-interactive.com>
2011-04-15 (0002) Kiall Mac Innes / <kiall@managedit.ie>
2011-04-29 (0002) Rob Skaggs / <rob@pivotal-it.com>
2011-08-23 (0003) Tom May / <tom@tommay.net>
2011-09-11 (0003) Lucas Hills / <info@lucashills.com>
2011-11-20 (0002) Chris Needham / <chrisn303@gmail.com>
2011-12-11 (0003) R.I.Pienaar / <rip@devco.net>
2011-12-13 (0001) tworker / <tworker@onyx.ove.com>
2011-12-13 (0001) Thiago Morello / <morellon@gmail.com>
2012-03-16 (0001) James Pearson / <james@fearmediocrity.co.uk>
2012-05-02 (0003) mindscratch / <craig@mindscratch.org>
2012-05-10 (0001) Tommy Bishop / <bishop.thomas@gmail.com>
2012-06-18 (0002) Jeremy Gailor / <jeremy@infinitecube.com>
2013-02-20 (0002) JP Hastings-Spital / <jphastings@gmail.com>
2013-03-14 (0003) glennr / <glenn@siyelo.com>
2013-07-29 (0020) Ian Smith / <ian.smith@mylookout.com>
2013-08-07 (0001) Hiram Chirino / <hiram@hiramchirino.com>
2013-08-15 (0005) Ian Smith / <ian.smith@lookout.com>
2013-09-26 (0001) Orazio Cotroneo / <orazio@we7.com>
2013-10-22 (0001) OrazioWE7 / <orazio@we7.com>
2014-03-13 (0001) Richard Clamp / <richardc@unixbeard.net>
2014-12-08 (0001) m4rCsi / <m4rCsi@gmail.com>
2015-09-05 (0001) Michael Klishin / <michael@novemberain.com>
2015-11-10 (0002) Patrick Sharp / <psharp@numerex.com>
2016-02-03 (0001) Wayne Robinson / <wayne.robinson@gmail.com>
2016-07-12 (0006) Nikolay Khasanov / <nkhasanov@groupon.com>
2016-06-02 (0001) Ryan Rosenblum / <ryan.rosenblum@gmail.com>
2016-08-17 (0002) Alexandre Moutot / <a.moutot@alphalink.fr>
2016-10-25 (0001) Raducu Deaconu / <raducu.deaconu@visma.com>
2017-03-23 (0001) Steve Traylen / <steve.traylen@cern.ch>
2017-06-01 (0001) Reid Vandewiele / <reid@puppetlabs.com>
2017-07-27 (0001) Meg Richards / <mouse@cmu.edu>
2018-11-19 (0003) Katharine / <krsibbald@gmail.com>

About

A ruby gem for sending and receiving messages from a Stomp protocol compliant message queue. Includes: failover logic, ssl support.

http://stomp.github.com

License:Apache License 2.0


Languages

Language:Ruby 99.0%Language:Shell 1.0%