Tuesday, 20 August 2013

Message publishing error using Kombu and Rabbitmq

Message publishing error using Kombu and Rabbitmq

I want to start off by saying that I'm new to not just python but
programming in general. With that in mind this is my issue. I am trying to
send some data to my Rabbitmq server. Below is my Python code. The
json_data is just a variable that holds some json formatted data.
with Connection("amqp://username:password@test_server.local:5672/#/") as
conn:
channel = conn.channel()
producer = Producer(channel, exchange = "test_exchange",
serializer="json") <--- Line 43
producer.publish(json_data)
print "Message sent"
This produces the following error:
Traceback (most recent call last): File "test.py", line 43, in <module>
producer = Producer(channel, exchange = "test_exchange",
serializer="json") File
"/Library/Python/2.7/site-packages/kombu/messaging.py", line 83, in
__init__ self.revive(self._channel) File
"/Library/Python/2.7/site-packages/kombu/messaging.py", line 210, in
revive self.exchange = self.exchange(channel) TypeError: 'str' object is
not callable
Any help would be appreciated. Thanks.

No comments:

Post a Comment