GithubHelp home page GithubHelp logo

luxiaoyuan / send-data-from-django-python-to-nodejs-through-rabbitmq Goto Github PK

View Code? Open in Web Editor NEW

This project forked from osharim/message-queue-django-and-nodejs

0.0 2.0 0.0 264 KB

How to send message/data from Django/Python to NodeJS using RabbitMQ

JavaScript 39.53% HTML 28.66% Python 31.82%

send-data-from-django-python-to-nodejs-through-rabbitmq's Introduction

#Downloading and Installing RabbitMQ

sudo apt-get install rabbitmq-server

#RabbitMQ RabbitMQ speaks a protocol called AMQP. To use Rabbit you'll need a library that understands the same protocol as Rabbit. There is a choice of libraries for almost every programming language. For python it's no different and there are a bunch of libraries to choose from:

py-amqplib txAMQP pika In this tutorial we're going to use pika.

Node.js && Python code through RabbitMQ

To successfully use the examples you will need a running RabbitMQ server.

Requirements

To run this example you need python> v2. *, nodeJS 0.8 (currently it runs on nodeJS 0.11.1-pre). Have installed RabbitMQ. Python 0.9.8 using the pika and amqp client and client nodeJS:

Installing amqp NodeJS in the work directory.

npm install

pika 0.9.8 Python client

sudo pip install pika==0.9.8

The installation depends on pip and git-core packages, you may need to install them first.

Ubuntu

$ sudo apt-get install python-pip git-core

Debian

$ sudo apt-get install python-setuptools git-core
$ sudo easy_install pip

Windows

> easy_install pip
>  pip install pika==0.9.8

THE MAGIC

To send data from python to NodeJS

`python send.py`

`$ node receive.js`

To send data from NodeJS to Python

`$ node send.js`

`$ python receive.py`

WORKERS

The message is sending by RabbitMQ Message Queue, then you can try to add more workers (receive.py or receive.js) to process all message in the queue on a distributed way.

Open N terminals and hit (receive.py or receive.js) to start to receive all messages in the queue.

send-data-from-django-python-to-nodejs-through-rabbitmq's People

Contributors

osharim avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.