Nilorea Library
C utilities for networking, threading, graphics
n_kafka.h File Reference

kafka generic produce and consume event header More...

#include "nilorea/n_log.h"
#include "nilorea/n_network.h"
#include "cJSON.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#include <libgen.h>
#include <errno.h>
#include <unistd.h>
#include "rdkafka.h"
+ Include dependency graph for n_kafka.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  N_KAFKA
 structure of a KAFKA consumer or producer handle More...
 
struct  N_KAFKA_EVENT
 structure of a KAFKA message More...
 

Macros

#define N_KAFKA_EVENT_CREATED   5
 state of a freshly created event More...
 
#define N_KAFKA_EVENT_ERROR   2
 state of an errored event More...
 
#define N_KAFKA_EVENT_OK   4
 state of an OK event More...
 
#define N_KAFKA_EVENT_QUEUED   0
 state of a queued event More...
 
#define N_KAFKA_EVENT_WAITING_ACK   1
 state of a sent event waiting for acknowledgement More...
 

Functions

int n_kafka_add_header (N_KAFKA_EVENT *event, N_STR *key, N_STR *value)
 add a header entry to an event. More...
 
int n_kafka_add_header_ex (N_KAFKA_EVENT *event, char *key, size_t key_length, char *value, size_t value_length)
 add a header entry to an event. More...
 
void n_kafka_delete (N_KAFKA *kafka)
 delete a N_KAFKA handle More...
 
int n_kafka_dump_unprocessed (N_KAFKA *kafka, char *directory)
 dump unprocessed/unset events More...
 
int n_kafka_event_destroy (N_KAFKA_EVENT **event)
 destroy a kafka event and set it's pointer to NULL More...
 
void n_kafka_event_destroy_ptr (void *event)
 festroy a kafka event More...
 
N_KAFKA_EVENTn_kafka_get_event (N_KAFKA *kafka)
 get a received event from the N_KAFKA kafka handle More...
 
int32_t n_kafka_get_schema_from_char (char *string)
 get a schema from the first 4 bytes of a char *string, returning ntohl of the value More...
 
int32_t n_kafka_get_schema_from_nstr (N_STR *string)
 get a schema from the first 4 bytes of a N_STR *string, returning ntohl of the value More...
 
int n_kafka_get_status (N_KAFKA *kafka, int *nb_queued, int *nb_waiting, int *nb_error)
 return the queues status More...
 
N_KAFKAn_kafka_load_config (char *config_file, int mode)
 load a kafka configuration from a file More...
 
int n_kafka_load_unprocessed (N_KAFKA *kafka, char *directory)
 load unprocessed/unset events More...
 
N_KAFKAn_kafka_new (int64_t poll_timeout, int64_t poll_interval, size_t errstr_len)
 allocate a new kafka handle More...
 
N_KAFKA_EVENTn_kafka_new_event (int schema_id)
 create a new empty event More...
 
N_KAFKA_EVENTn_kafka_new_event_from_char (char *string, size_t written, int schema_id)
 make a new event from a char *string More...
 
N_KAFKA_EVENTn_kafka_new_event_from_file (char *filename, int schema_id)
 make a new event from a N_STR *string More...
 
N_KAFKA_EVENTn_kafka_new_event_from_string (N_STR *string, int schema_id)
 make a new event from a N_STR *string More...
 
int n_kafka_new_headers (N_KAFKA_EVENT *event, size_t count)
 allocate a headers array for the event More...
 
int n_kafka_poll (N_KAFKA *kafka)
 Poll kafka handle in producer or consumer mode. More...
 
int n_kafka_produce (N_KAFKA *kafka, N_KAFKA_EVENT *event)
 put an event in the events_to_send list More...
 
int n_kafka_put_schema_in_char (char *string, int schema_id)
 put a htonl schema id into the first 4 bytes of a char *string More...
 
int n_kafka_put_schema_in_nstr (N_STR *string, int schema_id)
 put a htonl schema id into the first 4 bytes of a N_STR *string More...
 
int n_kafka_start_pooling_thread (N_KAFKA *kafka)
 start the pooling thread of a kafka handle More...
 
int n_kafka_stop_pooling_thread (N_KAFKA *kafka)
 stop the pooling thread of a kafka handle More...
 

Detailed Description

kafka generic produce and consume event header

Author
Castagnier Mickael
Version
1.0
Date
23/11/2022

Definition in file n_kafka.h.