juntossomosmais / django-stomp

🔃 A simple implementation of STOMP with Django
MIT License
37 stars 4 forks source link

Allow simultaneous STOMP message listening and HTTP protocol responding #76

Open leighsmith opened 1 month ago

leighsmith commented 1 month ago

One issue which is not clearly documented is that it doesn't seem possible to listen to messages on a STOMP message queue and be able to run the HTTP protocol server simultaneously?

Unfortunately, this is a very likely use-case: a Django web server is running, responding to HTTP requests from a user, which leads to sending a message on a STOMP queue, and waiting for a response on another STOMP queue, which will then update the Django database and the user then can refresh the page to see the result of the STOMP response queue.

At the moment, the pubsub command only listens to and responds to STOMP messages. This means at least two simultaneous execution instances of the django app are necessary: for runserver to respond to HTTP requests, and pubsub to respond to a particular message queue, so that the parallelism is pushed to the operating system and the database. The launching of these becomes more complicated if there are many queues that need to be listened to.

Would it be feasible to have start_processing() launched once the web server is running? There seems to be preliminary support for background processing with STOMP_PROCESS_MSG_ON_BACKGROUND? There could then be the option to issue multiple calls to start_processing() for each of the queues to be listened to.

ricardochaves commented 1 month ago

Hello @leighsmith , We have no plans for new implementations in this library. We are migrating everything to django-outbox-pattern because the outbox pattern is mandatory for us. We will only fix some bugs until our migration is complete, but we do not have a date for completion. In the future, this lib should be archived.