GithubHelp home page GithubHelp logo

jeremyshort / stomp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stompgem/stomp

0.0 2.0 0.0 1.3 MB

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

License: Apache License 2.0

Ruby 100.00%

stomp's Introduction

README

Overview

An implementation of the Stomp protocol for Ruby. See:

New

See CHANGELOG.rdoc for details.

  • Gem version 1.3.4. Miscellaneous fixes, see CHANGELOG.rdoc for details.

  • Gem version 1.3.3. Miscellaneous fixes, see CHANGELOG.rdoc for details.

  • Gem version 1.3.2. Miscellaneous fixes, see changelog for details.

  • Gem version 1.3.1. Bugfix for logging.

  • Gem version 1.3.0. Added ERROR frame raising as exception, added anonymous connections, miscellaneous other fixes.

  • Gem version 1.2.16. Fixed Stomp::Client to expose its connection’s host parameters.

  • Gem version 1.2.15. Timeout cleanup, added license info to gemspec.

  • Gem version 1.2.14. Cleanup.

  • Gem version 1.2.13. Stomp::Client#unreceive max_redeliveries fix.

  • Gem version 1.2.12. Miscellaneous issue fixes and cleanup.

  • Gem version 1.2.11. JRuby and AMQ support fixes.

  • Gem version 1.2.10. Support failover from heartbeat threads.

  • Gem version 1.2.9. Miscellaneous fixes and changes.

  • Gem version 1.2.8. Stomp 1.1+ header codec inversion fix, test refactoring.

  • Gem version 1.2.7. Stomp 1.2 support and miscellaneous fixes.

  • Gem version 1.2.6. Miscellaneous fixes and changes.

  • Gem version 1.2.5. Restructure. Forks with modifcations will be affected.

  • Gem version 1.2.4. Stomp 1.1 heartbeat fix, autoflush capability, miscellaneous fixes.

  • Gem version 1.2.3. Miscellaneous fixes, see changelog for details.

  • Gem version 1.2.2. Performance and more SSL enhancements.

  • Gem version 1.2.1. Full support of SSL certificates.

  • Gem version 1.2.0. Support of Stomp protocol level 1.1.

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

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

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

  # for 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

# 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:[email protected]: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

Historical Information

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

Source Code and Project URLs

https://github.com/stompgem/stomp/

Stomp Protocol Information :

http://stomp.github.com/index.html

Contributors

The following people have contributed to Stomp:

  • Brian McCallister

  • Glenn Rempe <[email protected]>

  • jstrachan

  • Marius Mathiesen <[email protected]>

  • Johan S√∏rensen <[email protected]>

  • Thiago Morello

  • Guy M. Allard <[email protected]>

  • kookster

  • Tony Garnock-Jones <[email protected]>

  • chirino

  • Stefan Saasen

  • Neil Wilson

  • Dinesh Majrekar

  • Kiall Mac Innes

  • Rob Skaggs

  • Tom May

  • Lucas Hills

  • Chris Needham

  • R.I. Pienaar

  • tworker

  • James Pearson

  • Craig

  • Tommy Bishop

  • Jeremy Gailor

  • JP Hastings-Spital

  • Glenn Roberts

  • Ian Smith

  • Orazio Cotroneo

stomp's People

Contributors

2potatocakes avatar chirino avatar chrisn avatar glennr avatar gmallard avatar grempe avatar ismith avatar jphastings avatar js avatar kiall avatar kpumuk avatar morellon avatar neilw avatar oraziocw avatar richardc avatar ripienaar avatar shortcut-kinder avatar thbishop avatar tommay avatar tonyg avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.