feature: adding Kafka infrastructure
This commit is contained in:
28
common/include/kafka.h
Normal file
28
common/include/kafka.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef _KAFKA_H
|
||||
#define _KAFKA_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
enum topic_idx
|
||||
{
|
||||
TOPIC_RULE_HITS,
|
||||
|
||||
// add more topic here
|
||||
|
||||
MAX_TOPIC_NUM,
|
||||
};
|
||||
|
||||
struct kafka *kafka_create(const char *profile);
|
||||
void kafka_destroy(struct kafka *handle);
|
||||
// return 0: if success
|
||||
// return -1: if failed
|
||||
int kafka_send(struct kafka *handle, enum topic_idx idx, const char *data, int len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -18,6 +18,7 @@ extern "C"
|
||||
#define LOG_TAG_UTILS "UTILS"
|
||||
#define LOG_TAG_HEALTH_CHECK "HEALTH_CHECK"
|
||||
#define LOG_TAG_TIMESTAMP "TIMESTAMP"
|
||||
#define LOG_TAG_KAFKA "KAFKA"
|
||||
|
||||
#define ATOMIC_INC(x) __atomic_fetch_add(x, 1, __ATOMIC_RELAXED)
|
||||
#define ATOMIC_DEC(x) __atomic_fetch_sub(x, 1, __ATOMIC_RELAXED)
|
||||
|
||||
Reference in New Issue
Block a user