wdtinc / flask-pika Goto Github PK
View Code? Open in Web Editor NEWFlask extension for Pika
License: Other
Flask extension for Pika
License: Other
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.
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)
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?
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.