Sha256: 263e206972a735ca5460e429815005fddf51b8e89c797cd905b56f78cdea684c

Contents?: true

Size: 1.98 KB

Versions: 1

Compression:

Stored size: 1.98 KB

Contents

# Introduction

Manage RabbitMQ structure of your virtual hosts. Similary to ActiveRecord schema.rb or structure.sql that dumps the current database schema, rabbitmq-schema will dump a ```db/rabbitmq_structure.json``` timestamped file with the representation of the virtual hosts, queues, exchanges, bindings, users and permissions.

## Installation

Include this to your development/test Gemfile:

```ruby
  gem 'rabbitmq-schema'
```

## Usage

Make sure you set an environment variable for the rabbitmq api (you can add the /api path or leave it out):
```
RABBITMQ_MANAGEMENT_URL=http://guest:guest@localhost:15672
```

### Create definition

Create a new vhost and definition for your application. It will create the vhosts of your choice and add permissions to the user in the environment variable to those vhosts.
```ruby
  bundle exec rake rabbitmq:create             # It will ask you what vhosts to create the definition with
  # or
  bundle exec rake rabbitmq:create VHOSTS=hats # It will directly create a vhost named '/hats' 
```

### Drop definition

Drop the vhosts in from your RabbitMQ instance and remove the file:
```ruby
  bundle exec rake rabbitmq:drop
```

### Dump definition
Dump the definition of the vhosts in your RabbitMQ instance into definition file:
```ruby
  bundle exec rake rabbitmq:dump             # It will dump the vhosts specificed in the existing definition file
  # or 
  bundle exec rake rabbitmq:dump VHOSTS=hats # It will dump the specified vhost in a new definition few
```

### Load definition
Load the vhosts definition from your definition file into your RabbitMQ instance:
```ruby
  bundle exec rake rabbitmq:load
```

### TODO

- [ ] Make it Rails independent
      - [ ] There's a few uses of Hash#except.
      - [ ] There's a few uses of Hash#with_indifferent_access.
      - [ ] The Engine class should only be loaded when Rails is present.
      - [ ] User should be able to indicate the file path for the structure.
      - [ ] Rails dependency should be removed from gemspec.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rabbitmq-definition-0.1.3 README.md