docs: add pubsub develop example for kafka#7059
Merged
Merged
Conversation
bzp2010
requested review from
membphis,
shuaijinchao,
spacewander and
tzssangglass
May 17, 2022 03:44
spacewander
reviewed
May 17, 2022
| message PubSubReq { | ||
| int64 sequence = 1; | ||
| oneof req { | ||
| CmdKafkaFetch cmd_kafka_fetch = 31; |
Contributor
Author
There was a problem hiding this comment.
updated to source file link
guitu168
reviewed
May 17, 2022
Comment on lines
+93
to
+95
| :::note Callback function prototype | ||
| The `params` is the data in the protocol definition; the first return value is the data, which needs to contain the fields in the response body definition, and returns the `nil` value when there is an error; the second return value is the error, and returns the error string when there is an error | ||
| ::: |
Contributor
There was a problem hiding this comment.
Suggested change
| :::note Callback function prototype | |
| The `params` is the data in the protocol definition; the first return value is the data, which needs to contain the fields in the response body definition, and returns the `nil` value when there is an error; the second return value is the error, and returns the error string when there is an error | |
| ::: | |
| :::note Callback function prototype | |
| The `params` is the data in the protocol definition; the first return value is the data, which needs to contain the fields in the response body definition, and returns the `nil` value when there is an error; the second return value is the error, and returns the error string when there is an error | |
| ::: |
|
|
||
| ```shell | ||
| curl -X PUT 'http://127.0.0.1:9080/apisix/admin/routes/kafka' \ | ||
| -H 'X-API-KEY: <api-key>' \ |
Contributor
There was a problem hiding this comment.
Suggested change
| -H 'X-API-KEY: <api-key>' \ | |
| -H 'X-API-KEY: ${api-key}' \ |
| The `params` is the data in the protocol definition; the first return value is the data, which needs to contain the fields in the response body definition, and returns the `nil` value when there is an error; the second return value is the error, and returns the error string when there is an error | ||
| ::: | ||
|
|
||
| Finally, it enters the loop to wait for client commands and when an error occurs it returns the error and stops the processing flow. |
Member
There was a problem hiding this comment.
Suggested change
| Finally, it enters the loop to wait for client commands and when an error occurs it returns the error and stops the processing flow. | |
| Finally, it enters the loop to wait for client commands, and when an error occurs, it returns the error and stops the processing flow. |
|
|
||
| #### Add a new `scheme` judgment branch to `http_access_phase` | ||
|
|
||
| Add a `scheme` judgment branch to the `http_access_phase` function in `apisix/init.lua` to support the processing of `kafka` type upstreams. Because of Apache Kafka has its own clustering and partition scheme, we do not need to use the Apache APISIX built-in load balancing algorithm, so we intercept and take over the processing flow before selecting the upstream node, here using the `kafka_access_phase` function. |
Member
There was a problem hiding this comment.
Suggested change
| Add a `scheme` judgment branch to the `http_access_phase` function in `apisix/init.lua` to support the processing of `kafka` type upstreams. Because of Apache Kafka has its own clustering and partition scheme, we do not need to use the Apache APISIX built-in load balancing algorithm, so we intercept and take over the processing flow before selecting the upstream node, here using the `kafka_access_phase` function. | |
| Add a `scheme` judgment branch to the `http_access_phase` function in `apisix/init.lua` to support the processing of `kafka` type upstreams. Because Apache Kafka has its clustering and partition scheme, we do not need to use the Apache APISIX built-in load balancing algorithm, so we intercept and take over the processing flow before selecting the upstream node, using the `kafka_access_phase` function. |
|
|
||
| First, create an instance of the `pubsub` module, which is provided in the `core` package. | ||
|
|
||
| Then, an instance of the Apache Kafka client is created, and this code is omitted here. |
Member
There was a problem hiding this comment.
Suggested change
| Then, an instance of the Apache Kafka client is created, and this code is omitted here. | |
| Then, an instance of the Apache Kafka client is created and omitted code here. |
tzssangglass
approved these changes
May 18, 2022
juzhiyuan
approved these changes
May 18, 2022
Liu-Junlin
pushed a commit
to Liu-Junlin/apisix
that referenced
this pull request
May 20, 2022
hongbinhsu
pushed a commit
to fitphp/apix
that referenced
this pull request
May 24, 2022
* upsgrteam/master: (351 commits) fix(proxy-cache): bypass when method mismatch cache_method (apache#7111) chore(script): support to install dependencies under arm64 (apache#7091) chore(ci): use the latest build script for apisix-base (apache#7090) fix(batch-requests): ignore "unix:" in the configuration (apache#7106) fix: install dependencies issues (apache#7092) feat(ops): use lua libs to backup config file insteadof shell command (apache#7048) test: reduce CI failure caused by flaky tests (apache#7085) chore(ci): move set_dns.sh to ci dir (apache#7089) feat: release 2.14.0 (apache#7057) docs: update "Tracers" Plugins (apache#7086) docs: update "Traffic" Plugin docs 3 (apache#7064) docs: update "Serverless" Plugins (apache#7076) feat(ops): check process running with posix.signal insteadof lsof (apache#7006) docs: modify how-to-build filename (apache#7087) docs: fix link of hot-reload in docs (apache#7081) chore(ci): apt update before install (apache#7080) docs: add pubsub develop example for kafka (apache#7059) ci: enable rebase in some situation (apache#7074) fix: redirect http to https but port not change (apache#7065) ci: make it pass under OpenResty 1.21 (apache#7067) ...
spacewander
pushed a commit
that referenced
this pull request
Jun 30, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add pubsub develop documentation example for Apache Kafka.
Checklist