-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(pubsub): support kafka #7032
Conversation
a8eca0a
to
ac25c0b
Compare
UpdateThere are still some test cases that have not been debug passed yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
use t::APISIX 'no_plan'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
t/admin/upstream5.t
we need a meaningful name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@membphis This is just because the previous upstreamX
test contains too many lines, and it does not point to the upstream scheme test of "Kafka", future upstream-related tests can also be added to this file (this test was moved here from t/node), which only tests whether the upstream in the Admin API can be created properly.
-- string to int64 cdata numbers. | ||
local function pb_convert_to_int64(src) | ||
if type(src) == "string" then | ||
return C.atoll(ffi.cast("char *", src) + 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's check src length to avoid out of bound
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
docs/en/latest/pubsub.md
Outdated
@@ -42,6 +42,10 @@ In Apache APISIX, the most common scenario is handling north-south traffic from | |||
|
|||
Currently, Apache APISIX supports WebSocket communication with the client, which can be any application that supports WebSocket, with Protocol Buffer as the serialization mechanism, see the [protocol definition](../../../apisix/pubsub.proto). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's update the path of definition. We should use absolute path as it's not in website
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
docs/en/latest/pubsub/kafka.md
Outdated
title: Apache Kafka | ||
keywords: | ||
- APISIX | ||
- Pub-Sub |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use PubSub like pubsub in other places?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All Pub-Sub
replaced to PubSub
|
||
### Limitations | ||
|
||
- Offsets need to be managed manually |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After rendering, these two lines are merged together...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
docs/en/latest/pubsub/kafka.md
Outdated
|
||
### Prepare | ||
|
||
First, it is necessary to compile the [communication protocol](../../../../apisix/pubsub.proto) as a language-specific SDK using the `protoc`, which provides the command and response definitions to connect to Kafka via APISIX using the WebSocket. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's update the path of definition. We should use absolute path as it's not in website
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
@@ -55,16 +73,18 @@ message CmdEmpty {} | |||
message PubSubReq { | |||
int64 sequence = 1; | |||
oneof req { | |||
CmdEmpty cmd_empty = 31; | |||
CmdPing cmd_ping = 32; | |||
CmdEmpty cmd_empty = 31; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove cmd_empty which is test-only? Using cmd_kafka_fetch
in pubsub.t is enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spacewander This would make the pubsub
module test the relevant code that relies on kafka
, and I'm not sure if I should do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about adding a comment to show that this cmd is test-only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After rechecking, I found that CmdEmpty has added a test-only flag.
apisix/apisix/include/apisix/model/pubsub.proto
Lines 35 to 39 in d955009
/** | |
* An empty command, a placeholder for testing purposes only | |
*/ | |
message CmdEmpty {} | |
Co-authored-by: soulbird <zhaothree@gmail.com>
Description
Provide kafka implementation on pubsub framework.
Split from #6995
Checklist