summaryrefslogtreecommitdiff
path: root/examples/amqps_producer.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/amqps_producer.c')
-rw-r--r--examples/amqps_producer.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/examples/amqps_producer.c b/examples/amqps_producer.c
index 04f5ae8..c67f8ca 100644
--- a/examples/amqps_producer.c
+++ b/examples/amqps_producer.c
@@ -44,9 +44,9 @@
#define SUMMARY_EVERY_US 1000000
static void send_batch(amqp_connection_state_t conn,
- char const *queue_name,
- int rate_limit,
- int message_count)
+ char const *queue_name,
+ int rate_limit,
+ int message_count)
{
uint64_t start_time = now_microseconds();
int i;
@@ -69,20 +69,20 @@ static void send_batch(amqp_connection_state_t conn,
uint64_t now = now_microseconds();
die_on_error(amqp_basic_publish(conn,
- 1,
- amqp_cstring_bytes("amq.direct"),
- amqp_cstring_bytes(queue_name),
- 0,
- 0,
- NULL,
- message_bytes),
- "Publishing");
+ 1,
+ amqp_cstring_bytes("amq.direct"),
+ amqp_cstring_bytes(queue_name),
+ 0,
+ 0,
+ NULL,
+ message_bytes),
+ "Publishing");
sent++;
if (now > next_summary_time) {
int countOverInterval = sent - previous_sent;
double intervalRate = countOverInterval / ((now - previous_report_time) / 1000000.0);
printf("%d ms: Sent %d - %d since last report (%d Hz)\n",
- (int)(now - start_time) / 1000, sent, countOverInterval, (int) intervalRate);
+ (int)(now - start_time) / 1000, sent, countOverInterval, (int) intervalRate);
previous_sent = sent;
previous_report_time = now;
@@ -105,7 +105,8 @@ static void send_batch(amqp_connection_state_t conn,
}
}
-int main(int argc, char const * const *argv) {
+int main(int argc, char const *const *argv)
+{
char const *hostname;
int port, status;
int rate_limit;
@@ -115,7 +116,7 @@ int main(int argc, char const * const *argv) {
if (argc < 5) {
fprintf(stderr, "Usage: amqps_producer host port rate_limit message_count "
- "[cacert.pem [key.pem cert.pem]]\n");
+ "[cacert.pem [key.pem cert.pem]]\n");
return 1;
}
@@ -152,7 +153,7 @@ int main(int argc, char const * const *argv) {
amqp_set_socket(conn, socket);
die_on_amqp_error(amqp_login(conn, "/", 0, 131072, 0, AMQP_SASL_METHOD_PLAIN, "guest", "guest"),
- "Logging in");
+ "Logging in");
amqp_channel_open(conn, 1);
die_on_amqp_error(amqp_get_rpc_reply(conn), "Opening channel");