Created
March 13, 2025 15:47
-
-
Save hguerrero/aaafec56aab9f68c5af842dd955733ca to your computer and use it in GitHub Desktop.
Kong tech enablement for 3.10 demos config
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
_format_version: "3.0" | |
_transform: true | |
services: | |
- name: request_callout | |
url: https://echo-api.3scale.net/ | |
routes: | |
- name: request_callout | |
hosts: | |
- callout.dev | |
paths: | |
- / | |
plugins: | |
- name: request-callout | |
config: | |
upstream: | |
# by_lua: |- | |
# kong.service.request.set_raw_body(kong.ctx.shared.callouts.c1.response.body) | |
body: | |
forward: false | |
custom: | |
username: "$(callouts.c1.response.body.username)" | |
country: "$(callouts.c2.response.body.country)" | |
callouts: | |
- name: c1 | |
request: | |
method: GET | |
url: http://localhost:8585/dynarest/users/v1/user | |
by_lua: |- | |
local body = kong.request.get_body() or {}; | |
local id = body.id; | |
if id then | |
kong.ctx.shared.callouts.c1.request.params.url = 'http://localhost:8585/dynarest/users/v1/user/' .. id | |
end | |
response: | |
body: | |
decode: true | |
- name: c2 | |
depends_on: | |
- c1 | |
request: | |
method: GET | |
url: http://localhost:8585/dynarest/address/v2/address | |
by_lua: |- | |
local body = kong.ctx.shared.callouts.c1.response.body or {}; | |
local id = body.address_id; | |
if id then | |
kong.ctx.shared.callouts.c2.request.params.url = 'http://localhost:8585/dynarest/address/v2/address/' .. id | |
end | |
response: | |
body: | |
decode: true | |
routes: | |
- name: kafka-consumer-sse | |
hosts: | |
- kafka.dev | |
paths: | |
- /kafka/consumer/sse | |
plugins: | |
- name: kafka-consume | |
config: | |
topics: | |
- name: test | |
mode: server-sent-events | |
bootstrap_servers: | |
- host: localhost | |
port: 9092 | |
- name: kafka-consumer-http-get | |
hosts: | |
- kafka.dev | |
paths: | |
- /kafka/consumer/http-get | |
plugins: | |
- name: kafka-consume | |
config: | |
topics: | |
- name: test | |
bootstrap_servers: | |
- host: localhost | |
port: 9092 | |
- name: kafka-producer | |
hosts: | |
- kafka.dev | |
paths: | |
- /kafka/producer | |
plugins: | |
- name: kafka-upstream | |
config: | |
topic: incoming | |
bootstrap_servers: | |
- host: localhost | |
port: 9092 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment