set kafka correlation id

This commit is contained in:
kedixa
2022-06-24 17:52:45 +08:00
parent d714def116
commit ecea9cbca6
4 changed files with 16 additions and 1 deletions
+2 -1
View File
@@ -1656,6 +1656,7 @@ KafkaMessage::KafkaMessage()
kafka_parser_init(this->parser);
this->stream = new EncodeStream;
this->api_type = Kafka_Unknown;
this->correlation_id = 0;
this->cur_size = 0;
}
@@ -1799,7 +1800,7 @@ int KafkaMessage::encode_head()
append_i32(this->headbuf, 0);
append_i16(this->headbuf, this->api_type);
append_i16(this->headbuf, this->api_version);
append_i32(this->headbuf, 0);
append_i32(this->headbuf, this->correlation_id);
append_string(this->headbuf, this->config.get_client_id());
return 0;
+4
View File
@@ -60,6 +60,9 @@ public:
void set_api_version(int ver) { this->api_version = ver; }
int get_api_version() const { return this->api_version; }
void set_correlation_id(int id) { this->correlation_id = id; }
int get_correlation_id() const { return this->correlation_id; }
void set_config(const KafkaConfig& conf)
{
this->config = conf;
@@ -197,6 +200,7 @@ protected:
int api_type;
int api_version;
int correlation_id;
int message_version;
std::map<int, int> api_mver_map;