diff options
author | Ask Solem <ask@celeryproject.org> | 2014-04-14 17:29:03 +0100 |
---|---|---|
committer | Ask Solem <ask@celeryproject.org> | 2014-04-14 17:29:03 +0100 |
commit | be3000b4c84d7503f5ef4067de44ff16d060d158 (patch) | |
tree | fecacb0f149b067202c443b59aad3cc027a0ff1c /tools | |
parent | dcb8edaccd6e164d624edfab0f3120d96f707f0a (diff) | |
parent | fe844e41ffad5691607982cbfe4054aacdcb81e0 (diff) | |
download | rabbitmq-c-github-ask-be3000b4c84d7503f5ef4067de44ff16d060d158.tar.gz |
Merge branch 'alanxz/master'
Conflicts:
Makefile.am
codegen
Diffstat (limited to 'tools')
-rw-r--r-- | tools/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tools/common.c | 5 | ||||
-rw-r--r-- | tools/consume.c | 16 | ||||
-rw-r--r-- | tools/doc/amqp-consume.xml | 15 | ||||
-rw-r--r-- | tools/publish.c | 2 |
5 files changed, 30 insertions, 10 deletions
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 9b352fb..f9b899a 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,5 +1,5 @@ # vim:set ts=2 sw=2 sts=2 et: -include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${LIBRABBITMQ_INCLUDE_DIRS} ${POPT_INCLUDE_DIRS}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${LIBRABBITMQ_INCLUDE_DIRS} ${POPT_INCLUDE_DIR}) if (WIN32) set(PLATFORM_DIR win32) diff --git a/tools/common.c b/tools/common.c index a624105..06b41a9 100644 --- a/tools/common.c +++ b/tools/common.c @@ -332,7 +332,7 @@ amqp_connection_state_t make_connection(void) conn = amqp_new_connection(); if (ci.ssl) { #ifdef WITH_SSL - socket = amqp_ssl_socket_new(); + socket = amqp_ssl_socket_new(conn); if (!socket) { die("creating SSL/TLS socket"); } @@ -346,7 +346,7 @@ amqp_connection_state_t make_connection(void) die("librabbitmq was not built with SSL/TLS support"); #endif } else { - socket = amqp_tcp_socket_new(); + socket = amqp_tcp_socket_new(conn); if (!socket) { die("creating TCP socket (out of memory)"); } @@ -355,7 +355,6 @@ amqp_connection_state_t make_connection(void) if (status) { die("opening socket to %s:%d", ci.host, ci.port); } - amqp_set_socket(conn, socket); die_rpc(amqp_login(conn, ci.vhost, 0, 131072, 0, AMQP_SASL_METHOD_PLAIN, ci.user, ci.password), diff --git a/tools/consume.c b/tools/consume.c index 9075302..5b7777e 100644 --- a/tools/consume.c +++ b/tools/consume.c @@ -75,7 +75,8 @@ static char *stringify_bytes(amqp_bytes_t bytes) static amqp_bytes_t setup_queue(amqp_connection_state_t conn, char *queue, char *exchange, - char *routing_key, int declare) + char *routing_key, int declare, + int exclusive) { amqp_bytes_t queue_bytes = cstring_bytes(queue); @@ -92,10 +93,10 @@ static amqp_bytes_t setup_queue(amqp_connection_state_t conn, exit(1); } - if (!queue || exchange || declare) { + if (!queue || exchange || declare || exclusive) { /* Declare the queue as auto-delete. */ amqp_queue_declare_ok_t *res = amqp_queue_declare(conn, 1, - queue_bytes, 0, 0, 1, 1, + queue_bytes, 0, 0, exclusive, 1, amqp_empty_table); if (!res) { die_rpc(amqp_get_rpc_reply(conn), "queue.declare"); @@ -193,6 +194,7 @@ int main(int argc, const char **argv) char *exchange = NULL; char *routing_key = NULL; int declare = 0; + int exclusive = 0; int no_ack = 0; int count = -1; amqp_bytes_t queue_bytes; @@ -213,7 +215,11 @@ int main(int argc, const char **argv) }, { "declare", 'd', POPT_ARG_NONE, &declare, 0, - "declare an exclusive queue", NULL + "declare an exclusive queue (deprecated, use --exclusive instead)", NULL + }, + { + "exclusive", 'x', POPT_ARG_NONE, &exclusive, 0, + "declare the queue as exclusive", NULL }, { "no-ack", 'A', POPT_ARG_NONE, &no_ack, 0, @@ -239,7 +245,7 @@ int main(int argc, const char **argv) } conn = make_connection(); - queue_bytes = setup_queue(conn, queue, exchange, routing_key, declare); + queue_bytes = setup_queue(conn, queue, exchange, routing_key, declare, exclusive); do_consume(conn, queue_bytes, no_ack, count, cmd_argv); close_connection(conn); return 0; diff --git a/tools/doc/amqp-consume.xml b/tools/doc/amqp-consume.xml index b5f40d7..f6f51ba 100644 --- a/tools/doc/amqp-consume.xml +++ b/tools/doc/amqp-consume.xml @@ -119,6 +119,21 @@ <option>--queue</option> option, but no binding to an exchange is requested with the <option>--exchange</option> option. + Note: this option is deprecated and may be + removed in a future version, use the + <option>--exclusive</option> option to + explicitly declare an exclusive queue. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><option>-x</option></term> + <term><option>--exclusive</option></term> + <listitem> + <para> + Declared queues are non-exclusive by default, + this option forces declaration of exclusive + queues. </para> </listitem> </varlistentry> diff --git a/tools/publish.c b/tools/publish.c index 4fe43cb..552d8d0 100644 --- a/tools/publish.c +++ b/tools/publish.c @@ -120,7 +120,7 @@ int main(int argc, const char **argv) memset(&props, 0, sizeof props); props._flags = AMQP_BASIC_DELIVERY_MODE_FLAG; - props.delivery_mode = 2; /* persistent delivery mode */ + props.delivery_mode = delivery; if (content_type) { props._flags |= AMQP_BASIC_CONTENT_TYPE_FLAG; |