Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run the publisher and flask app simultaneously #11

Open
sourabhsriom opened this issue Oct 31, 2018 · 1 comment
Open

Unable to run the publisher and flask app simultaneously #11

sourabhsriom opened this issue Oct 31, 2018 · 1 comment

Comments

@sourabhsriom
Copy link

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?

@NimzyMaina
Copy link

Hi, @sourabhsriom did you find a solution for this? Do you happen to have an implementation of the consumer in flask as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants