Changeset 962 for trunk/Monitoring
- Timestamp:
- 11/04/13 15:39:39 (10 years ago)
- Location:
- trunk/Monitoring/CNClient
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Monitoring/CNClient/Makefile
r942 r962 1 sendAMQPMsg: 2 #gcc -static -I/usr/local/include -L/usr/local/lib -Wall -o sendAMQPMsg send_AMQP_msg.c -lrabbitmq 3 gcc -static -Wall -o sendAMQPMsg send_AMQP_msg.c -lrabbitmq 1 #all: clean 2 # sendAMQPMsg 3 4 sendAMQPMsg: send_AMQP_msg.c 5 gcc -static -I/usr/local/include -L/usr/local/lib -Wall -o sendAMQPMsg send_AMQP_msg.c -lrabbitmq 4 6 5 7 install: sendAMQPMsg 6 8 sudo cp sendAMQPMsg /usr/local/bin 9 10 clean: sendAMQPMsg 11 rm -f sendAMQPMsg -
trunk/Monitoring/CNClient/send_AMQP_msg.c
r866 r962 234 234 int main(int argc, char * const *argv) { 235 235 char const *hostname; 236 int msg_count=1; 236 237 int port; 237 238 //char const *exchange; … … 242 243 char *buf = NULL; 243 244 int c; 245 int i; 244 246 char *filepath = NULL; 245 247 int file_flag=0; … … 252 254 //parsing args 253 255 opterr = 0; 254 while ((c = getopt (argc, argv, "b:ef:h: p:")) != -1)256 while ((c = getopt (argc, argv, "b:ef:h:n:p:u")) != -1) 255 257 switch (c) 256 258 { … … 259 261 break; 260 262 case 'e': 261 262 fprintf(stderr, "Usage: amqp_producer host port\n");263 264 263 265 264 // --- example without config card --- … … 286 285 hostname = optarg; 287 286 break; 287 case 'n': 288 msg_count = atoi(optarg); 289 break; 288 290 case 'p': 289 291 port = atoi(optarg); 290 292 break; 293 case 'u': 294 fprintf(stderr, "Usage: amqp_producer host port -b <body>\n"); 295 exit(EXIT_SUCCESS); 291 296 case '?': 292 297 fprintf (stderr, "ERR001: incorrect argument '-%c'.\n", optopt); … … 374 379 props.content_type = amqp_cstring_bytes("text/plain"); 375 380 props.delivery_mode = 2; /* persistent delivery mode */ 376 die_on_error(amqp_basic_publish(conn, 1, amqp_cstring_bytes("myexchange"), amqp_cstring_bytes(""), 0, 0, &props, amqp_cstring_bytes(body)), "Publishing"); 381 382 383 for (i = 0; i < msg_count; i++) 384 die_on_error(amqp_basic_publish(conn, 1, amqp_cstring_bytes("myexchange"), amqp_cstring_bytes(""), 0, 0, &props, amqp_cstring_bytes(body)), "Publishing"); 377 385 } 378 386
Note: See TracChangeset
for help on using the changeset viewer.