Giter Club home page Giter Club logo

hovercat's Introduction

Code Climate codebeat badge Build Status

Hovercat

Hovercat is a client for Rabbitmq

Your focuses on ease of use. It focus on to retry send message when message broker is down

Supported RabbitMQ Versions

RabbitMQ 3.3+.

Installation & Bundler Dependency

Install in your Gemfile:

gem 'hovercat', git: 'https://github.com/Mobile4You/hovercat.git'

Getting Started

First of all you have to genereate a configuration file

You can generate de configuration file running the following command:

$ hovercat memory_store

It will generate a configuration file like this:

hovercat:
  rabbitmq:
    host: 'localhost'
    port: 5672
    exchange: ''
    vhost: '/'
    user: 'guest'
    password: 'guest'
  retries_in_rabbit_mq:
    retry_attempts: 3
    retry_delay_in_seconds: 600

You can specify rabbitmq configurations in configuration file or via params in Hovercat::Sender.publish

Creating hovercat message is very simple, you only have to extend Hovercat::Models::Message:

Example:

  class Message < Hovercat::Models::Message
    def initialize(name:, email:)
      super('my.routing.key.name')
    
      add resource: name, as: :name
      add resource: email, as: :email
    end
  end

To send a message, you have to use Hovercat::Sender.publish:

Example:

  message = Message.new(name: 'My name', email: '[email protected]')
  params = { message: message, exchange: 'my-exchange', header: { 'header-example': 'my-header'} }
  Hovercat::Sender.publish(params)

If you use exchange via param, it has precedence over exchange name in configuration file

If you have old version of hovervat and would like to upgrade

1 - Execute

bundle update hovercat

2 - Change your message model

from:

Hovercat::Message
Hovercat::MessageGateway
Hovercat::UnableToSendMessageError

to:

Hovercat::Models::Message
Hovercat::Gateways::MessageGateway
Hovercat::Errors::UnableToSendMessageError

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

hovercat's People

Contributors

clrbpacheco avatar diogotravassos avatar lbernardelli avatar rodaguiar avatar rodolfoburla 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.