예제 #1
0
static void
afstomp_worker_thread_init(LogThrDestDriver *s)
{
  STOMPDestDriver *self = (STOMPDestDriver*) s;

  afstomp_dd_connect(self, FALSE);
}
예제 #2
0
static gboolean
afstomp_worker_insert(LogThrDestDriver *s)
{
  STOMPDestDriver *self = (STOMPDestDriver *)s;
  gboolean success;
  LogMessage *msg;
  LogPathOptions path_options = LOG_PATH_OPTIONS_INIT;

  if (!afstomp_dd_connect(self, TRUE))
    return FALSE;

  success = log_queue_pop_head(self->super.queue, &msg, &path_options, FALSE, FALSE);
  if (!success)
    return TRUE;

  msg_set_context(msg);
  success = afstomp_worker_publish (self, msg);
  msg_set_context(NULL);

  if (success)
    {
      stats_counter_inc(self->super.stored_messages);
      step_sequence_number(&self->seq_num);
      log_msg_ack(msg, &path_options);
      log_msg_unref(msg);
    }
  else
    {
      log_queue_push_head(self->super.queue, msg, &path_options);
    }

  return success;
}
예제 #3
0
static worker_insert_result_t
afstomp_worker_insert(LogThrDestDriver *s, LogMessage *msg)
{
  STOMPDestDriver *self = (STOMPDestDriver *)s;

  if (!afstomp_dd_connect(self, TRUE))
    return WORKER_INSERT_RESULT_NOT_CONNECTED;

  if (!afstomp_worker_publish (self, msg))
    return WORKER_INSERT_RESULT_ERROR;

  return WORKER_INSERT_RESULT_SUCCESS;
}