I'm using php to send the message to rabbitmq and a python consumer to process it. Here is what I did.
This part send a json to rabbitmq.
$data = array(
'id' => 123,
'url' => 'baidu.com',
);
$msg = new AMQPMessage(json_encode($data));
$channel->basic_publish($msg, $exchange);
And this part receive the message and process it (using celery).
@app.task
def mytask(json_obj):
print(json_obj)
data = json.loads(json_obj)
thread_id = data['id']
url = data['url']
return py_read(thread_id, url)
Here is what I get from the console:
[2014-09-29 15:51:34,564: WARNING/MainProcess] celery@mickey-Thurley ready.
[2014-09-29 15:51:37,395: WARNING/MainProcess] Received and deleted unknown message. Wrong destination?!?
The full contents of the message body was: body: '{"id":123,"url":"baidu.com"}' (28b)
{content_type:None content_encoding:None
delivery_info:{'redelivered': False, 'routing_key': '', 'exchange': 'celery', 'delivery_tag': 1, 'consumer_tag': '4'} headers={}}
I'm sure that the consumer received the message, but why the message didn't be processd? and what should I do to deal with it?