2016-05-18 49 views
1

我有一個shell腳本,它通過amqp-publish將文本消息發送到Java Spring RabbitMQ服務器。通過bash中的amqp-publish發送JSON

amqp-publish -u amqp://guest:[email protected]/%2f -r "queue.udrive.ustorage" -e "directExchangeUdrive" -b "$msg" 

所以我想送一個JSON消息,我不喜歡這個,但我有錯誤...

amqp-publish -u amqp://guest:[email protected]/%2f -r "queue.udrive.ustorage" -e "directExchangeUdrive" -p -C application/json "$msg" 
Usage: amqp-publish [-?] [-u|--url=amqp://...] [-s|--server=hostname] [--port=port] [--vhost=vhost] [--username=username] 
     [--password=password] [--ssl] [--cacert=cacert.pem] [--key=key.pem] [--cert=cert.pem] [-e|--exchange=exchange] 
     [-r|--routing-key=routing key] [-p|--persistent] [-C|--content-type=content type] [-t|--reply-to=reply to] 
     [-l|--line-buffered] [-E|--content-encoding=content encoding] [-b|--body=body] [-?|--help] [--usage] [OPTIONS]... 

回答

1

"$msg"

amqp-publish -u amqp://guest:[email protected]/%2f -r "queue.udrive.ustorage" -e "directExchangeUdrive" -p -C application/json-b"$msg"

添加 -b參數