summaryrefslogtreecommitdiff
path: root/examples/amqps_listenq.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/amqps_listenq.c')
-rw-r--r--examples/amqps_listenq.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/examples/amqps_listenq.c b/examples/amqps_listenq.c
index 1422964..3f6d425 100644
--- a/examples/amqps_listenq.c
+++ b/examples/amqps_listenq.c
@@ -37,8 +37,8 @@
*/
#include <stdint.h>
-#include <stdlib.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <amqp.h>
@@ -48,8 +48,7 @@
#include "utils.h"
-int main(int argc, char const *const *argv)
-{
+int main(int argc, char const *const *argv) {
char const *hostname;
int port, status;
char const *queuename;
@@ -57,7 +56,8 @@ int main(int argc, char const *const *argv)
amqp_connection_state_t conn;
if (argc < 4) {
- fprintf(stderr, "Usage: amqps_listenq host port queuename "
+ fprintf(stderr,
+ "Usage: amqps_listenq host port queuename "
"[cacert.pem [verifypeer] [verifyhostname] [key.pem cert.pem]]\n");
return 1;
}
@@ -99,18 +99,19 @@ int main(int argc, char const *const *argv)
}
}
-
status = amqp_socket_open(socket, hostname, port);
if (status) {
die("opening SSL/TLS connection");
}
- die_on_amqp_error(amqp_login(conn, "/", 0, 131072, 0, AMQP_SASL_METHOD_PLAIN, "guest", "guest"),
+ die_on_amqp_error(amqp_login(conn, "/", 0, 131072, 0, AMQP_SASL_METHOD_PLAIN,
+ "guest", "guest"),
"Logging in");
amqp_channel_open(conn, 1);
die_on_amqp_error(amqp_get_rpc_reply(conn), "Opening channel");
- amqp_basic_consume(conn, 1, amqp_cstring_bytes(queuename), amqp_empty_bytes, 0, 0, 0, amqp_empty_table);
+ amqp_basic_consume(conn, 1, amqp_cstring_bytes(queuename), amqp_empty_bytes,
+ 0, 0, 0, amqp_empty_table);
die_on_amqp_error(amqp_get_rpc_reply(conn), "Consuming");
{
@@ -127,14 +128,14 @@ int main(int argc, char const *const *argv)
}
printf("Delivery %u, exchange %.*s routingkey %.*s\n",
- (unsigned) envelope.delivery_tag,
- (int) envelope.exchange.len, (char *) envelope.exchange.bytes,
- (int) envelope.routing_key.len, (char *) envelope.routing_key.bytes);
+ (unsigned)envelope.delivery_tag, (int)envelope.exchange.len,
+ (char *)envelope.exchange.bytes, (int)envelope.routing_key.len,
+ (char *)envelope.routing_key.bytes);
if (envelope.message.properties._flags & AMQP_BASIC_CONTENT_TYPE_FLAG) {
printf("Content-type: %.*s\n",
- (int) envelope.message.properties.content_type.len,
- (char *) envelope.message.properties.content_type.bytes);
+ (int)envelope.message.properties.content_type.len,
+ (char *)envelope.message.properties.content_type.bytes);
}
printf("----\n");
@@ -144,8 +145,10 @@ int main(int argc, char const *const *argv)
}
}
- 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");
+ 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");
die_on_error(amqp_destroy_connection(conn), "Ending connection");
return 0;