amqp_empty_table);
#endif
- if (mod_amqp_log_if_amqp_error(amqp_get_rpc_reply(profile->conn_active->state), "Checking for command exchange")) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Profile[%s] failed to create missing command exchange", profile->name);
+ if (mod_amqp_log_if_amqp_error(amqp_get_rpc_reply(profile->conn_active->state), "Checking for command exchange\n")) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Profile[%s] failed to create missing command exchange\n", profile->name);
continue;
}
/* Ensure we have a queue */
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Creating command queue");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Creating command queue\n");
recv_queue = amqp_queue_declare(profile->conn_active->state, // state
1, // channel
profile->queue ? amqp_cstring_bytes(profile->queue) : amqp_empty_bytes, // queue name
0, 1, // exclusive, auto-delete
amqp_empty_table); // args
- if (mod_amqp_log_if_amqp_error(amqp_get_rpc_reply(profile->conn_active->state), "Declaring queue")) {
+ if (mod_amqp_log_if_amqp_error(amqp_get_rpc_reply(profile->conn_active->state), "Declaring queue\n")) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Profile[%s] failed to connect with code(%d), sleeping for %dms\n",
profile->name, status, profile->reconnect_interval_ms);
switch_sleep(profile->reconnect_interval_ms * 1000);
} else if (!strncmp(var, "content-type", 12)) {
content_type = switch_core_strdup(profile->pool, val);
} else if (!strncmp(var, "format_fields", 13)) {
+ char *tmp;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "amqp format fields : %s\n", val);
if ((format_fields_size = mod_amqp_count_chars(val, ',')) >= MAX_ROUTING_KEY_FORMAT_FIELDS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "You can have only %d routing fields in the routing key.\n",
}
/* increment size because the count returned the number of separators, not number of fields */
+ tmp = strdup(val);
format_fields_size++;
- switch_separate_string(val, ',', format_fields, MAX_ROUTING_KEY_FORMAT_FIELDS);
+ switch_separate_string(tmp, ',', format_fields, MAX_ROUTING_KEY_FORMAT_FIELDS);
format_fields[format_fields_size] = NULL;
+ free(tmp);
} else if (!strncmp(var, "event_filter", 12)) {
/* Parse new events */
profile->event_subscriptions = switch_separate_string(val, ',', argv, (sizeof(argv) / sizeof(argv[0])));
amqp_empty_table);
#endif
- if (mod_amqp_log_if_amqp_error(amqp_get_rpc_reply(profile->conn_active->state), "Declaring exchange")) {
+ if (mod_amqp_log_if_amqp_error(amqp_get_rpc_reply(profile->conn_active->state), "Declaring exchange\n")) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile[%s] failed to create exchange\n", profile->name);
goto err;
}
return SWITCH_STATUS_FALSE;
}
+ if (reload) {
+ switch_hash_index_t *hi;
+ mod_amqp_producer_profile_t *producer;
+ mod_amqp_command_profile_t *command;
+ mod_amqp_logging_profile_t *logging;
+
+ switch_event_unbind_callback(mod_amqp_producer_event_handler);
+
+ while ((hi = switch_core_hash_first(mod_amqp_globals.producer_hash))) {
+ switch_core_hash_this(hi, NULL, NULL, (void **)&producer);
+ mod_amqp_producer_destroy(&producer);
+ }
+ while ((hi = switch_core_hash_first(mod_amqp_globals.command_hash))) {
+ switch_core_hash_this(hi, NULL, NULL, (void **)&command);
+ mod_amqp_command_destroy(&command);
+ }
+
+ switch_log_unbind_logger(mod_amqp_logging_recv);
+
+ while ((hi = switch_core_hash_first(mod_amqp_globals.logging_hash))) {
+ switch_core_hash_this(hi, NULL, NULL, (void **)&logging);
+ mod_amqp_logging_destroy(&logging);
+ }
+ }
+
if ((profiles = switch_xml_child(cfg, "producers"))) {
if ((profile = switch_xml_child(profiles, "profile"))) {
for (; profile; profile = profile->next) {