summaryrefslogtreecommitdiff
path: root/examples/amqp_producer.c
diff options
context:
space:
mode:
authorAlan Antonuk <alan.antonuk@gmail.com>2013-04-08 14:52:53 -0700
committerAlan Antonuk <alan.antonuk@gmail.com>2013-04-08 14:52:53 -0700
commitad2b116059e22d393b7e44ad54f345a3fb4e267b (patch)
treecfd98876757f85d9fe7bfe56d179bd5fb63a8ff0 /examples/amqp_producer.c
parentf3074030723b840690458983b63c746549aa3bd5 (diff)
downloadrabbitmq-c-github-ask-ad2b116059e22d393b7e44ad54f345a3fb4e267b.tar.gz
Formatted source code with astyle utilty
Diffstat (limited to 'examples/amqp_producer.c')
-rw-r--r--examples/amqp_producer.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/examples/amqp_producer.c b/examples/amqp_producer.c
index d85b944..4a1cd68 100644
--- a/examples/amqp_producer.c
+++ b/examples/amqp_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;
int rate_limit;
@@ -129,7 +130,7 @@ 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, "/", 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");