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")
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.
After banging my head against my desk I figured out that Python didn't like the calling of the exchange. Then my coworker told me that it might work better if I include the exchange and routing key in the publisher. So now my new code looks like this.