Reputation: 1
I have used in a previous project used ZeroMQ to send messages between a two different python program on different servers. I now have a program that I would want to use Django as a front end for.
Doing alot of googling on message queues and python the most common thing that is coming up is Celery and RabbitMQ. But this doesn't seem like what I am looking for. Celery seems good for use produce tasks within the Django application and process them and write the result back to Django.
What I am looking for is a solution that allows me to when I create or delete a new model item to send a message to the other python program. When the other python program gets an error os simillar I want to send a message back to Django and create a new Error Model item.
Is there a good way to do this? What I could do is using different techniques for the sending and reciving from django. I could send simple UDP to my other program and post stuff back to django via HTTP API. But I think it would be nicer to have some form of messaging system that handles this and assures the messages arrives.
Upvotes: 0
Views: 1310
Reputation: 15145
Not sure where you are stuck, so I will try to cover everything.
In the project I am currently working on we are using APIs and rabbitmq to pass messages around.
We have a python, non-django process listening to a rabbitmq queue, so when Django needs to talk to it we just pump JSON formatted messages into the queue and the process picks the messages up and processes them.
You can actually use django models and other APIs with a non-django app. If that is what you want to do here is a link to start
http://blog.gabrielsaldana.org/using-django-models-in-external-python-scripts/
Our other external process needs to pass information back into Django, so we just made some API endpoints and the external process just uses HTTP POST to send data.
To do things every time a model is created or saved you want to look into Django signals.
https://docs.djangoproject.com/en/1.9/topics/signals/
If I am still missing something, you need to explain better what exactly is the problem you are trying to solve
Upvotes: 2