0

I have an existing flask application (having a bunch of REST apis) which is hosted by Gunicorn. I also have to send and receive messages from AmazonMQ in the same application. I have functions using stomp.py to send/receive messages from AmazonMQ, but I am not sure where to place them, or how should I use them so as to keep existing flow intact

Arindam
  • 1
  • 1
  • I'd recommend a separate process to talk with the message queue. If you like, you can have that separate process then make HTTP requests to your main Flask app so as to keep everything in the same flow. – AKX Sep 04 '20 at 12:53
  • Are you suggesting to use Process from multiprocessing python library, to spin up two different processes? One will handle flask, other will talk to the queue? – Arindam Sep 04 '20 at 13:42
  • You don't need the multiprocessing library, just start another process, like you'd start your gunicorn application server. – AKX Sep 04 '20 at 13:43

1 Answers1

0

Hey thanks for help @AKX, I resolved the issue by triggering the whole process of messaging (Creation of connection, subscription to channel etc) by a method call from on_starting(server) method in gunicorn_config.py

Arindam
  • 1
  • 1