Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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))
share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

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.

share|improve this answer
    
Note I'm using RabbitMQ. File is sent up as a JSON encoded string (for now). –  fred basset Aug 19 '12 at 21:07
    
updated my answer –  Chida Aug 19 '12 at 21:13
    
I created a config file specifyinga large frame_max, didn't seem to affect the behavior however. My config. file is : {rabbit, [{frame_max, 20000000}, {log_levels, [{connection, info}]}]} ]. –  fred basset Aug 20 '12 at 20:19
    
It looks like Pika is limited to 128K data size. Message me if you know how to get around this? –  fred basset Aug 22 '12 at 3:12
add comment

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.

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.