1) android (client):

Getting Started with RabbitMQ on Android – Part 1介绍了如何在android上使用rabbitmq接收server端的push通知。

 

2) server :

server端安装rabbitmq,写了个python脚本来发送消息,例子代码:

#!/usr/bin/env python
import pika
import time

connection = pika.BlockingConnection(pika.ConnectionParameters(
host='localhost'))
channel = connection.channel()


channel.queue_declare(queue='hello')

i = 0
while True:
channel.basic_publish(exchange='logs',
routing_key='hello',
body='Hello World, ' + str(i))
print " [x] Sent 'Hello World!'" + str(i)
i += 1
time.sleep(1)
connection.close()

关于用python如何用rabbitmq发消息,参见:RabbitMQ introduction 

代码见:rabbitmq (RabbitMQ - messaging that just works)

 

相关文章:

  • 2021-10-29
  • 2021-08-17
  • 2022-01-07
  • 2021-07-09
  • 2021-10-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-30
  • 2021-04-17
  • 2021-09-23
  • 2021-08-18
  • 2021-05-05
  • 2022-02-02
相关资源
相似解决方案