Skip to content
Snippets Groups Projects
Commit e4f9d3e4 authored by George Sedov's avatar George Sedov
Browse files

Add rdkafka client

Adds rdkafka dependency, rdkafka client,
and notification for file close event
parent 5138d1c2
No related branches found
No related tags found
No related merge requests found
#include "request_handler_kafka_notify.h"
#include "../request.h"
namespace asapo {
Error RequestHandlerKafkaNotify::ProcessRequest(Request* request) const {
if (!kafka_client_) {
//client was not initialized, ignore
return nullptr;
}
std::string message = "{"
"\"event\":\"IN_CLOSE_WRITE\","
"\"path\":\"" + request->GetFileName() + "\""
"}";
return kafka_client_->Send(message, "asapo");
}
StatisticEntity RequestHandlerKafkaNotify::GetStatisticEntity() const {
return StatisticEntity::kNetwork;
}
RequestHandlerKafkaNotify::RequestHandlerKafkaNotify() : kafka_client_{GetKafkaClient()} {
}
}
\ No newline at end of file
#ifndef ASAPO_REQUEST_HANDLER_KAFKA_NOTIFY_H
#define ASAPO_REQUEST_HANDLER_KAFKA_NOTIFY_H
#include "request_handler.h"
#include "asapo/kafka_client/kafka_client.h"
namespace asapo {
class RequestHandlerKafkaNotify final : public ReceiverRequestHandler {
public:
RequestHandlerKafkaNotify();
StatisticEntity GetStatisticEntity() const override;
Error ProcessRequest(Request* request) const override;
private:
std::unique_ptr<KafkaClient> kafka_client_;
};
}
#endif //ASAPO_REQUEST_HANDLER_KAFKA_NOTIFY_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment