Coder Social home page Coder Social logo

flask-pika's People

Contributors

maximium avatar mniehe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flask-pika's Issues

Pool Params isn't optional

Leaving FLASK_PIKA_POOL_PARAMS out of the config causes an error. The variable needs to exist but set as None to not use the pooling features.

KeyError when checking if channel should be recycled

After 16 requests, the error starts occurring.

The params:

app.config['FLASK_PIKA_POOL_PARAMS'] = {
    'pool_size': 16,
    'pool_recycle': 600
}

The trace stack is shown below

File "D:\project\controllers\pikatest.py", line 32, in test_place
    ch = pika.channel()
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\flask_pika.py", line 132, in channel
    if self.__should_recycle_channel(ch):
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\flask_pika.py", line 115, in __should_recycle_channel
    recycle_time = self.channel_recycle_times[hash(channel)]
KeyError: 4410099

The code that gets executed every request.

ch = pika.channel()
ch.basic_publish(exchange='', routing_key='place', body=json.dumps(body))
pika.return_channel(ch)

Unable to run the publisher and flask app simultaneously

Hello,

I am trying to use your library to be able to run multiple pika subscribers/publishers in a flask app. I think I am not using the library right because once I run my code, I am not able to see the flask app started message on my console. Below is the code I wrote using your guidelines :

from flask import Flask
from flask_pika import Pika as FPika

app = Flask(__name__)
app.config['FLASK_PIKA_PARAMS'] = {
    'host':'localhost',      #amqp.server.com
    'port': 5672,            #amqp server port
    'username' : 'guest',
    'password' : 'guest',
    'virtual_host':'vhost'   #amqp vhost
}


app.config['FLASK_PIKA_POOL_PARAMS'] =  {
    'pool_size': 8,
    'pool_recycle': 600
}
fpika = FPika(app)


ch = fpika.channel()
ch.basic_publish(exchange='daemon',routing_key='routing_key',exchange_type = 'fanout')
fpika.return_channel(ch)

if __name__ == "__main__":
    app.run()

Could you please review this and tell me if this looks good or what is the problem here?

upgrade pika

your pika requirement in the setup.py is quite old. using pipenv with a newer version of pika complains about it, because I manually have pika in it w/ the newest version. could you update the repo quickly to make it >0.10.0 and release again?

thx

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.