54#define N_KAFKA_EVENT_QUEUED 0
56#define N_KAFKA_EVENT_WAITING_ACK 1
58#define N_KAFKA_EVENT_ERROR 2
60#define N_KAFKA_EVENT_OK 4
62#define N_KAFKA_EVENT_CREATED 5
Structure of a generic LIST container.
int32_t event_production_enabled
bool flag to suspend or restart event production
int32_t poll_interval
poll interval in msecs
rd_kafka_topic_partition_list_t * subscription
subscribed topics
int polling_thread_status
polling thread status, 0 => off , 1 => on , 2 => wants to stop, will be turned out to 0 by exiting po...
cJSON * configuration
kafka json configuration holder
size_t nb_waiting
number of events waiting for an ack in the waiting list
int mode
kafka handle mode: RD_KAFKA_CONSUMER or RD_KAFKA_PRODUCER
char ** topics
list of topics to subscribe to
int schema_id
kafka schema_id
rd_kafka_topic_t * rd_kafka_topic
kafka topic handle
rd_kafka_headers_t * rd_kafka_headers
kafka produce event headers structure handle
pthread_rwlock_t rwlock
access lock
N_STR * errstr
kafka error string holder
rd_kafka_conf_t * rd_kafka_conf
kafka structure handle
LIST * received_events
list of received N_KAFKA_EVENT
LIST * events_to_send
list of N_KAFKA_EVENT to send
int32_t poll_timeout
poll timeout in msecs
pthread_t polling_thread
polling thread id
rd_kafka_t * rd_kafka_handle
kafka handle (producer or consumer)
LIST * received_headers
kafka consume event headers structure handle
N_STR * event_string
string containing the topic id + payload
char * event_cmd
eventual custom event_cmd
int32_t monitored_directory_interval
monitored directory refresh interval in msecs
char * groupid
consumer group id
N_STR * event_files_to_delete
string containing the original event source file name if it is to be deleted when event is produced.
int32_t event_consumption_enabled
bool flag to suspend or restart event consumption
int schema_id
kafka schema id in network order
struct N_KAFKA * parent_table
access lock
size_t nb_queued
number of waiting events in the producer waiting list
size_t nb_error
number of errored events
char * bootstrap_servers
kafka bootstrap servers string
char * from_topic
in case of received event, else NULL
unsigned int status
state of the event: N_KAFKA_EVENT_CREATED ,N_KAFKA_EVENT_QUEUED , N_KAFKA_EVENT_WAITING_ACK ,...
char * topic
kafka topic string
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 to an event (extended version)
int n_kafka_dump_unprocessed(N_KAFKA *kafka, char *directory)
dump unprocessed events to a directory
N_KAFKA_EVENT * n_kafka_get_event(N_KAFKA *kafka)
get the next received event
int n_kafka_stop_polling_thread(N_KAFKA *kafka)
stop the kafka polling thread
int32_t n_kafka_get_schema_from_nstr(const N_STR *string)
get schema id from an N_STR string
int n_kafka_new_headers(N_KAFKA_EVENT *event, size_t count)
create new headers for an event
int n_kafka_put_schema_in_nstr(N_STR *string, int schema_id)
put schema id in an N_STR string
int n_kafka_enable_event_production(N_KAFKA *kafka)
enable event production
int n_kafka_disable_event_consumption(N_KAFKA *kafka)
disable event consumption
N_KAFKA * n_kafka_load_config(char *config_file, int mode)
load kafka configuration from file
int n_kafka_disable_event_production(N_KAFKA *kafka)
disable event production
int n_kafka_get_status(N_KAFKA *kafka, size_t *nb_queued, size_t *nb_waiting, size_t *nb_error)
get kafka queue status counters
int n_kafka_put_schema_in_char(char *string, int schema_id)
put schema id in a char string
int n_kafka_poll(N_KAFKA *kafka)
poll kafka for events
int n_kafka_start_polling_thread(N_KAFKA *kafka)
start the kafka polling thread
N_KAFKA_EVENT * n_kafka_new_event_from_char(const char *string, size_t written, int schema_id)
create a new kafka event from a char string
N_KAFKA_EVENT * n_kafka_new_event_from_string(const N_STR *string, int schema_id)
create a new kafka event from an N_STR string
int n_kafka_event_destroy(N_KAFKA_EVENT **event)
destroy a kafka event
int n_kafka_enable_event_consumption(N_KAFKA *kafka)
enable event consumption
void n_kafka_event_destroy_ptr(void *event)
destroy a kafka event (void pointer version for list destructor)
int32_t n_kafka_get_schema_from_char(const char *string)
get schema id from a char string
int n_kafka_add_header(N_KAFKA_EVENT *event, N_STR *key, N_STR *value)
add a header to an event
int n_kafka_load_unprocessed(N_KAFKA *kafka, const char *directory)
load unprocessed events from a directory
int n_kafka_produce(N_KAFKA *kafka, N_KAFKA_EVENT *event)
produce a kafka event
N_KAFKA_EVENT * n_kafka_new_event(int schema_id)
create a new empty kafka event
N_KAFKA_EVENT * n_kafka_new_event_from_file(char *filename, int schema_id)
create a new kafka event from a file
N_KAFKA * n_kafka_new(int32_t poll_timeout, int32_t poll_interval, size_t errstr_len)
create a new kafka handle
void n_kafka_delete(N_KAFKA *kafka)
delete a kafka handle
structure of a KAFKA consumer or producer handle
structure of a KAFKA message
A box including a string and his lenght.