Show
Ignore:
Timestamp:
07/14/09 02:29:36 (9 years ago)
Author:
Dan Di Spaltro <dan.dispaltro@gmail.com>
git-committer:
Dan Di Spaltro <dan.dispaltro@gmail.com> 1247538576 +0000
git-parent:

[3db67ae5b26eab5ce769c235b8a2e672325cadb7]

git-author:
Dan Di Spaltro <dan.dispaltro@gmail.com> 1247538576 +0000
Message:

first go at integrating RMQ and AMQ and giving the user a choice on configuration options, refs #157

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/stratcon_iep.c

    r4fd2f1f r4c3fb9b  
    6969#endif 
    7070  apr_pool_t *pool; 
     71  char* exchange; 
    7172}; 
    7273pthread_key_t iep_connection; 
     
    288289    int port; 
    289290    char hostname[128]; 
    290     if(!noit_conf_get_int(NULL, "/stratcon/iep/port", &port)) 
     291    if(!noit_conf_get_int(NULL, "/stratcon/iep/stomp/port", &port)) 
    291292      port = 61613; 
    292     if(!noit_conf_get_stringbuf(NULL, "/stratcon/iep/hostname", 
     293    if(!noit_conf_get_stringbuf(NULL, "/stratcon/iep/stomp/hostname", 
    293294                                hostname, sizeof(hostname))) 
    294295      strlcpy(hostname, "127.0.0.1", sizeof(hostname)); 
     
    313314    { 
    314315      stomp_frame frame; 
     316      char username[128]; 
     317      char password[128]; 
     318      char* exchange = malloc(128); 
    315319      frame.command = "CONNECT"; 
    316320      frame.headers = apr_hash_make(driver->pool); 
     321      // This is for RabbitMQ Support 
     322      if((noit_conf_get_stringbuf(NULL, "/stratcon/iep/stomp/username", 
     323                                  username, sizeof(username))) && 
     324         (noit_conf_get_stringbuf(NULL, "/stratcon/iep/stomp/password", 
     325                                  password, sizeof(password)))) 
     326      { 
     327        apr_hash_set(frame.headers, "login", APR_HASH_KEY_STRING, username); 
     328        apr_hash_set(frame.headers, "passcode", APR_HASH_KEY_STRING, password); 
     329      } 
     330 
     331 
     332      // This is for RabbitMQ support 
     333      driver->exchange = NULL; 
     334      if(noit_conf_get_stringbuf(NULL, "/stratcon/iep/stomp/exchange", 
     335                                  exchange, 128)) 
     336      { 
     337        if (!driver->exchange) 
     338          driver->exchange = exchange; 
     339        else 
     340          free(exchange); 
     341        apr_hash_set(frame.headers, "exchange", APR_HASH_KEY_STRING, driver->exchange); 
     342      } 
     343 
     344 
     345 
    317346/* 
    318347      We don't use login/pass 
     
    408437        out.command = "SEND"; 
    409438        out.headers = apr_hash_make(job->pool); 
     439        if (driver->exchange) 
     440          apr_hash_set(out.headers, "exchange", APR_HASH_KEY_STRING, driver->exchange); 
     441 
    410442        apr_hash_set(out.headers, "destination", APR_HASH_KEY_STRING, "/queue/noit.firehose"); 
    411443        apr_hash_set(out.headers, "ack", APR_HASH_KEY_STRING, "auto"); 
     
    488520#else 
    489521  if(driver->connection) stomp_disconnect(&driver->connection); 
     522  if(driver->exchange) free(driver->exchange); 
    490523#endif 
    491524  if(driver->pool) apr_pool_destroy(driver->pool);