Skip to content

Commit e1defb7

Browse files
bzp2010Liu-Junlin
authored andcommitted
feat: add default handler for pubsub ping command (apache#7058)
1 parent 0a19d7c commit e1defb7

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

apisix/core/pubsub.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ function _M.new()
123123
cmd_handler = {},
124124
}, mt)
125125

126+
-- add default ping handler
127+
obj:on("cmd_ping", function (params)
128+
return { pong_resp = params }
129+
end)
130+
126131
return obj
127132
end
128133

apisix/include/apisix/model/pubsub.proto

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ message CmdKafkaFetch {
7373
message PubSubReq {
7474
int64 sequence = 1;
7575
oneof req {
76-
CmdEmpty cmd_empty = 31;
77-
CmdPing cmd_ping = 32;
76+
CmdEmpty cmd_empty = 31;
77+
CmdPing cmd_ping = 32;
7878
CmdKafkaFetch cmd_kafka_fetch = 33;
7979
CmdKafkaListOffset cmd_kafka_list_offset = 34;
8080
};
@@ -135,9 +135,9 @@ message KafkaListOffsetResp {
135135
message PubSubResp {
136136
int64 sequence = 1;
137137
oneof resp {
138-
ErrorResp error_resp = 31;
139-
PongResp pong_resp = 32;
140-
KafkaFetchResp kafka_fetch_resp = 33;
138+
ErrorResp error_resp = 31;
139+
PongResp pong_resp = 32;
140+
KafkaFetchResp kafka_fetch_resp = 33;
141141
KafkaListOffsetResp kafka_list_offset_resp = 34;
142142
};
143143
}

0 commit comments

Comments
 (0)