static gboolean afamqp_worker_insert(LogThrDestDriver *s) { AMQPDestDriver *self = (AMQPDestDriver *)s; gboolean success; LogMessage *msg; LogPathOptions path_options = LOG_PATH_OPTIONS_INIT; afamqp_dd_connect(self, TRUE); success = log_queue_pop_head(s->queue, &msg, &path_options, FALSE, FALSE); if (!success) return TRUE; msg_set_context(msg); success = afamqp_worker_publish (self, msg); msg_set_context(NULL); if (success) { stats_counter_inc(s->stored_messages); step_sequence_number(&self->seq_num); log_msg_ack(msg, &path_options); log_msg_unref(msg); } else log_queue_push_head(s->queue, msg, &path_options); return success; }
static worker_insert_result_t afamqp_worker_insert(LogThrDestDriver *s, LogMessage *msg) { AMQPDestDriver *self = (AMQPDestDriver *)s; if (!afamqp_dd_connect(self, TRUE)) return WORKER_INSERT_RESULT_NOT_CONNECTED; if (!afamqp_worker_publish (self, msg)) return WORKER_INSERT_RESULT_ERROR; return WORKER_INSERT_RESULT_SUCCESS; }