Giter VIP home page Giter VIP logo

rabbitmq-spec's Introduction

rabbitmq-spec

Travis Code Climate Test Coverage

Gem for documenting and configuring RabbitMQ.

It uses the specification files themselves to setup all the exchanges, queues and bindings on RabbitMQ.

Installation

Add this line to your application's Gemfile:

gem 'rabbitmq-spec'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rabbitmq-spec

Usage

Specification files

You can document your RabbitMQ architecture using this gem DSL.

We suggest to make a new folder called mqspecs and put your RabbitMQ Specification there. You can define everything in one file or split in many files/subfolders.

Example:


├── my_app/
│   ├── ...
├── mqspecs/
│   ├── exchange1_mqspec.rb
│   ├── exchange2_mqspec.rb
│   ├── ...

On each mqspec file. You can use the following syntax:

  exchange 'exchange-name' do
    description 'exchange-description' # optional

    # exchange options are forwarded to Bunny Channel#exchanged method
    # http://reference.rubybunny.info/Bunny/Channel.html#exchange-instance_method
    options do
      type 'topic'
      durable true
    end

    # this queue will be binded to the parent exchange
    # it will be created if it not exists yet.
    queue 'queue-name' do
      description 'queue1 description' # optional
      routing_key 'my-custom-routing-key' # optional

      # queue options are forwarded to Bunny Channel#queue method
      # http://reference.rubybunny.info/Bunny/Channel.html#queue-instance_methodChannel.html#exchange-instance_method
      options do
        durable true
      end
    end
  end

  # you can declare queues outside exchanges.
  # The setup process will not bind them to anything
  queue 'queue-name' do
    description 'queue1 description'
    options do
      durable true
    end
  end

RabbitMQ Setup

To understand how to use rabbitmq-spec just type the following on your shell after installing the gem:

rabbitmq-spec

It will list all the available commands and how to use them. Example:


$ rabbitmq-spec
USAGE
    rabbitmq-spec command [options]

COMMANDS
    setup     
    Usage: rabbitmq-spec setup ./mqspec [-u 'amqp://guest:guest@localhost:5672']
    Configure RabbitMQ using the mqspecs files.
    If you pass a ruby file it will evaluate it.
    If you pass a folder it will look for all the files finishing with "_mqspec.rb" and evaluate them.


OPTIONS
    -h --help      show help for rabbitmq-spec

Development

After checking out the repo, run bin/setup to install dependencies.

No additional configuration is needed.

Here we're using Rspec with simplecov and rubocop.

Contributing

If you have any idea for a feature or have found any bugs feel free to open a new issue at:

https://github.com/viniciusoyama/rabbitmq-spec.

License

The gem is available as open source under the terms of the MIT License.

rabbitmq-spec's People

Contributors

viniciusoyama 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.