Fast STOMP parser for Ruby
Ruby Ragel in Ruby Host Java
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
ext
lib
spec
.gitignore
.rspec
.travis.yml
Brewfile
Gemfile
MIT-LICENSE.txt
README.md
Rakefile
parser_common.rl
stomp_parser.gemspec

README.md

StompParser

Build Status Code Climate Gem Version

Fast STOMP parser and serializer for Ruby with native extensions in C for MRI and Rubinius and in Java for JRuby, as well as a pure Ruby parser.

Parsing

parser = StompParser::Parser.new
parser.parse(chunk) do |frame|
  puts "We received #{frame.command} frame with #{frame.body} and headers #{frame.headers}!"
end

The chunks do not have to be complete STOMP frames. The callback will be called whenever a complete frame has been parsed. Additionally, StompParser handles escape sequences in headers and body encoding for you.

Serializing

StompParser::Frame.new("SEND", { some: "header" }, "Hello").to_str

Development

Development should be ez.

git clone git@github.com:elabs/stomp_parser.git # git, http://git-scm.com/
cd stomp_parser
brew bundle # Homebrew, http://brew.sh/
bundle install # Bundler, http://bundler.io/
rake # compile state machine, run test suite

A few notes:

  • Native dependencies are listed in the Brewfile.
  • The stomp message parser is written in Ragel, see parser_common.rl.
  • Graphviz is used to visualize the Ragel state machine.
  • Most rake tasks will compile the state machine anew if needed.

Contributing

  1. Fork it on GitHub (http://github.com/elabs/stomp_parser/fork).
  2. Create your feature branch (git checkout -b my-new-feature).
  3. Follow the Development instructions in this README.
  4. Create your changes, please add tests.
  5. Commit your changes (git commit -am 'Add some feature').
  6. Push to the branch (git push origin my-new-feature).
  7. Create new pull request on GitHub.

License

MIT