Git Product home page Git Product logo

agentredrabbit's Introduction

agentredrabbit: Redis to RabbitMQ transport agent

agentredrabbit is a transport agent written in Python which moves data from Redis to RabbitMQ. It uses multithreaded workers to do the job and supports failsafe graceful shutdown and recovery.

agentredrabbit

  • agentredrabbit on startup loads failed messages from a dump file, if any
  • Thread workers synchronize using a global lock when working with failsafe queue
  • It polls to check any messages in a Redis list by name queue:queue1 and pops messages in max. chunk size of 100 and tries to publish to RabbitMQ broker
  • If message publishing fails, it saves the chunk to an internal failsafe message queue (a heap queue), stops consuming from Redis and retries publishing to RabbitMQ
  • On shutdown, a global event object is used and it dumps any messages from its failsafe queue to a dump file
  • On connectivity failures, it tries to reconnect to either Redis or RabbitMQ

Naming conventions and assumptions

  • AMQP heartbeat is assumed at 100s.
  • AMQP exchange routing key string is of format: hostname.queuename.log
  • For every RabbitMQ queue named q that is to be transported, the corresponding Redis list name is assumed as queue:q
  • Any service that is populating data in Redis should push in the corresponding list(s) using RPUSH, agentredrabbit uses LPUSH, LPOP, LTRIM, LRANGE commands internally

Building

Dependencies:

  • pika
  • redis (with hiredis for fast parsing)
  • nose, mock (for tests)
  • Local outbound SMTP server for sending email notifications

These are taken care of by the installation procedure.

Doc generation

To generate documentation of the code:

$ make docs

This requires epydoc and will generate documentation in docs/agentredrabbit.

Tests

To run unit tests:

$ make runtests

Installation

To install agentredrabbit, simply:

$ make build
$ make install

Usage

After installation, get help docs:

$ agentredrabbit --help

Run with a configuration:

$ agentredrabbit --config /path/to/conf.cfg

Example of running as a background process manually:

$ agentredrabbit -c /path/to/cfg > agent.log 2> agent.log &

Using init.d script for process management after make install:

$ /etc/init.d/agentredrabbit {start|stop|restart}

Author

Rohit "bhaisaab" Yadav, [email protected]

Contributing

Send a pull request on the GitHub repository: https://github.com/wingify/agentredrabbit

You may contact the author and Wingify's engineering team on [email protected]

Acknowledgements and Attributions

Example code of Async publisher using pika

Copyright and License

Licensed under the opensource permissive MIT license.

Copyright 2013 Rohit "bhaisaab" Yadav, Wingify

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

agentredrabbit's People

Contributors

ankneo avatar rohityadavcloud avatar vaidik avatar

Watchers

 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.