4

I'm learning RabbitMQ and have run the hello world example at http://www.rabbitmq.com/tutorials/tutorial-one-python.html without problems on localhost. Now I want to test messaging from my PC to a different server, receive.py never seems to get any messages. Perhaps I'm not specifying the hostnames correctly?

Receive.py:


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

connection = pika.BlockingConnection(pika.ConnectionParameters(
        host='66.175.x.x'))
channel = connection.channel()

channel.queue_declare(queue='hello')

print ' [*] Waiting for messages. To exit press CTRL+C'

def callback(ch, method, properties, body):
    data = json.loads(body)
    print "Log filename is " + data["filename"]
    print data["content"]

channel.basic_consume(callback,
                      queue='hello',
                      no_ack=True)

channel.start_consuming()

send.py:


#!/usr/bin/env python
import pika
import json
import sys

filename = sys.argv[1]
logdata = open(filename, 'r').read()

connection = pika.BlockingConnection(pika.ConnectionParameters(
        host='66.175.x.x'))
channel = connection.channel()

channel.queue_declare(queue='logupload')
n = filename.rfind('\\')
if n != -1:
    filename = filename[n + 1:]
data = {"filename":filename, "logdata":logdata}

channel.basic_publish(exchange='',
                      routing_key='logupload',
                      body=json.dumps(data))
connection.close()
print "sent %s %d bytes" % (filename, len(logdata))
fred basset
  • 665
  • 2
  • 7
  • 14

2 Answers2

3

RabbitMQ -- http://www.rabbitmq.com/configure.html

See the frame_max. Seems like 128KB is supported by default. You may want to check that setting in your installation.

Chida
  • 2,471
  • 1
  • 16
  • 29
2

Make sure rabbitmq is actually listening on port 5672 and that the port is open in your Linode server's firewall.

In your config, RABBITMQ_NODE_IP_ADDRESS should be blank, RABBITMQ_NODE_PORT should be 5672.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
  • I checked I don't have a firewall running and have no rabbitmq config. file. This morning it started working with no changes. My next problem is that smaller log files (~10K) are not being received but larger files (>= ~100K) are sent OK. Is there some type of buffering that prevents smaller data payloads from being sent or received? – fred basset Aug 19 '12 at 18:52
  • Actually current behavior is that small files (~64 bytes) are being received, but larger files (~52K) are not. What would prevent one file from being transferred over another? – fred basset Aug 19 '12 at 19:55