Giter Club home page Giter Club logo

lazyrabbit's Introduction

LazyRabbit for RabbitMQ

An stupidly easy wrapper over the Pika amqp package for RabbitMQ for the lazy python dev.

pika-amqp : https://github.com/pika/pika

Send a message

val = dict()
val["test"] = "value"    
mq = LazyRabbit("testq1")
mq.ADD_OR_GET(val)
# Only dict input allowed

This library also now auto recovers connections if the main thread is busy, and cannot communicate with MQ broker to establish heartbeat.This is observed with long running tasks that output to a queue.

Get a message

mq = LazyRabbit("testq1")
dict_from_mq = mq.ADD_OR_GET()
#returns None if queue is empty

Settings for class object

(you really don't need to look at this if you're lazy)

  • queue : The name of the queue you want to send to. (No defaults)
  • exchange= The exchange used to route the message to above queue (default : 'LazyRabbit')
  • ip= The IP on which the RabbitMQ is running (default :'localhost')
  • exchange_type=Type of exchange declared in 'exchange' arg , can be 'direct' or 'fanout' (default: 'direct')
  • log_level='INFO'
  • send=True (True|False) if to create a sender connection
  • get=True (True|False) if to create a getter connection
  • getter_wait= The time to sleep if no message if found in queue (default : 0.1s)
  • getter_wait_long= The time to sleep if no message if found in queue 1000 times or greater consecutively (default : 10s)

lazyrabbit's People

Contributors

jaideepkekre avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

guohaiquan2020

lazyrabbit's Issues

User / Password

How to connect if RabbitMQ server has user/password auth?

Deadletter Queue / Exchange?

Dead letter queues and exchanges??
I guess they should be created by default, using the input queue name , exchange name.

This should be configurable if defaults are not liked by the dev.

Packaging?

How to package and distribute this library?

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.