summaryrefslogtreecommitdiff
path: root/examples/amqp_sendstring.c
diff options
context:
space:
mode:
authorTony Garnock-Jones <tonyg@kcbbs.gen.nz>2009-05-12 06:39:26 +0100
committerTony Garnock-Jones <tonyg@kcbbs.gen.nz>2009-05-12 06:39:26 +0100
commitaabfa202da960cb782cf7c0b90a54cee5969e1fb (patch)
treeac96edee91c0f9e3b01956b76f1cbcfbd9a632dc /examples/amqp_sendstring.c
parentefc0f1ddc3a677434869258e62da90d00fa177cd (diff)
downloadrabbitmq-c-github-ask-aabfa202da960cb782cf7c0b90a54cee5969e1fb.tar.gz
Support for multiple channels.
- amqp_login() no longer does amqp_channel_open() for you - amqp_login() takes a channel_max argument - amqp_login() actually calls amqp_tune_connection() now - amqp_channel_close() and amqp_basic_publish() now take a channel number
Diffstat (limited to 'examples/amqp_sendstring.c')
-rw-r--r--examples/amqp_sendstring.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/amqp_sendstring.c b/examples/amqp_sendstring.c
index c914f86..a26cd3a 100644
--- a/examples/amqp_sendstring.c
+++ b/examples/amqp_sendstring.c
@@ -35,14 +35,17 @@ int main(int argc, char const * const *argv) {
die_on_error(sockfd = amqp_open_socket(hostname, port), "Opening socket");
amqp_set_sockfd(conn, sockfd);
- die_on_amqp_error(amqp_login(conn, "/", 131072, AMQP_SASL_METHOD_PLAIN, "guest", "guest"),
+ die_on_amqp_error(amqp_login(conn, "/", 0, 131072, AMQP_SASL_METHOD_PLAIN, "guest", "guest"),
"Logging in");
+ amqp_channel_open(conn, 1);
+ die_on_amqp_error(amqp_rpc_reply, "Opening channel");
{
amqp_basic_properties_t props;
props._flags = AMQP_BASIC_CONTENT_TYPE_FLAG;
props.content_type = amqp_cstring_bytes("text/plain");
die_on_error(amqp_basic_publish(conn,
+ 1,
amqp_cstring_bytes(exchange),
amqp_cstring_bytes(routingkey),
0,
@@ -52,7 +55,7 @@ int main(int argc, char const * const *argv) {
"Publishing");
}
- die_on_amqp_error(amqp_channel_close(conn, AMQP_REPLY_SUCCESS), "Closing channel");
+ die_on_amqp_error(amqp_channel_close(conn, 1, AMQP_REPLY_SUCCESS), "Closing channel");
die_on_amqp_error(amqp_connection_close(conn, AMQP_REPLY_SUCCESS), "Closing connection");
amqp_destroy_connection(conn);
die_on_error(close(sockfd), "Closing socket");