communicate between php and django with rabbitmq

90 views
Skip to first unread message

f pichlu

unread,
Feb 19, 2017, 1:56:58 AM2/19/17
to rabbitmq-users
Hi
i am using a php project for producer and pushing user data with json format as message in queue
and using django project for consumer and using queue message for create and edit user data,but i don't know how implement django with rabbitmq and pika!
i want when django project is running,if queue has a message,django pull it and using the message data

Michael Klishin

unread,
Feb 19, 2017, 2:02:54 AM2/19/17
to rabbitm...@googlegroups.com, f pichlu
You certainly can connect a PHP producer with a Python consumer. You can start with
the tutorials in both and then use e.g. a PHP publisher in tutorial 2 and a Python consumer from the same tutorial:
http://www.rabbitmq.com/getstarted.html

I’m not sure if by “Django” you mean Python in general or Django specifically since embedding
consumers into Web apps, while certainly possible, can be painful and counterintuitive.
So I’d recommend looking into a standalone Python app that shares modules with the Django one,
or something of that nature.
> --
> You received this message because you are subscribed to the Google Groups "rabbitmq-users"
> group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
> To post to this group, send an email to rabbitm...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

--
MK

Staff Software Engineer, Pivotal/RabbitMQ


f pichlu

unread,
Feb 19, 2017, 3:09:02 AM2/19/17
to rabbitmq-users, f.pi...@gmail.com
thank you MK
I read that and run python script,it work well and python receive message,also in RPC sample,python send response to php
Django framework run this script in model and view layers,i don't know how implement this py script in Django structure!

Michael Klishin

unread,
Feb 19, 2017, 3:12:51 AM2/19/17
to rabbitm...@googlegroups.com, f pichlu
I'm not a Django expert and this list is not about Django. Like I said, embedding consumers
into Web apps is a bit weird and if you can, you should avoid it.

I'd certainly be surprised of Django views were invoked by RabbitMQ consumers. Why not
use HTTP or a standalone AMQP 0-9-1 consumer (or share a few internal modules between the two)?

To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

f pichlu

unread,
Feb 22, 2017, 8:05:24 AM2/22/17
to Michael Klishin, rabbitm...@googlegroups.com
HI all
i do this with celery and Rabbitmq
in django every worker has a task.py file and celery.py file,by these i config the celery with celery.py and setting.py and write a task.py in my application for queue managing.
run celery and fetch queue data :)


To post to this group, send email to rabbitm...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages