Skip to content

Commit

Permalink
feat: kafka adapter (asyncapi#342)
Browse files Browse the repository at this point in the history
Co-authored-by: Fran Mendez <fmvilas@gmail.com>
  • Loading branch information
Ruchip16 and fmvilas committed Jan 25, 2023
1 parent d07d74e commit b2e9d52
Show file tree
Hide file tree
Showing 18 changed files with 20,315 additions and 6,591 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ dist
coverage
.vscode
.glee
.next
.next
13 changes: 13 additions & 0 deletions docs/config-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ This function must return an object with the following shape:
export default async function () {
return {
glee: {},
kafka: {},
websocket: {},
mqtt: {},
cluster: {}
Expand Down Expand Up @@ -124,3 +125,15 @@ These configurations apply to Glee itself, rather than any specific protocol.
|mqtt.authentication.userPassword| username and password parameters for authentication|
|mqtt.authentication.userPassword.username| username parameter
|mqtt.authentication.userPassword.password| password parameter
### Kafka
|Field|Description|
|---|---|
|kafka.authentication| Kafka authentication configuration|
|kafka.authentication.key | Kafka Broker Key
|kafka.authentication.cert| Client certificate
|kafka.authentication.clientId| Kafka client Id for authentication
|kafka.authentication.rejectUnauthorized | Boolean flag for accepting the valid SSL certificates
|kafka.authentication.username| The username to use during authentication.
|kafka.authentication.password| The password to use during authentication.
2 changes: 1 addition & 1 deletion examples/dummy/.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
GLEE_SERVER_CERTS=mosquitto:mosquitto.org.crt
GLEE_SERVER_CERTS=mosquitto:mosquitto.org.crt
2 changes: 1 addition & 1 deletion examples/dummy/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/kafka-test/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GLEE_SERVER_NAMES=mykafka
4 changes: 4 additions & 0 deletions examples/kafka-test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
.glee
.vscode
local.env
3 changes: 3 additions & 0 deletions examples/kafka-test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Dummy

This is a dummy example mainly used to test functionalities.
31 changes: 31 additions & 0 deletions examples/kafka-test/asyncapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
asyncapi: 2.4.0
info:
title: Kafka test
version: '1'
servers:
mykafka:
url: kafka://pkc-6ojv2.us-west4.gcp.confluent.cloud:9092
protocol: kafka-secure
security:
- saslScramExample: []
channels:
test:
publish:
operationId: onTest
message:
$ref: '#/components/messages/testMessage'
produce:
subscribe:
message:
$ref: '#/components/messages/testMessage'
components:
messages:
testMessage:
payload:
type: object
properties:
test:
type: string
securitySchemes:
saslScramExample:
type: scramSha256
10 changes: 10 additions & 0 deletions examples/kafka-test/functions/onTest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default async function (event) {
return {
send: [{
server: event.serverName,
channel: 'produce',
payload: event.payload,
headers: event.headers,
}]
}
}
9 changes: 9 additions & 0 deletions examples/kafka-test/glee.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default async function () {
return {
kafkaOptions: {
authentication: {
key: 'XIL3PSQNLE3ROP7A',
}
}
}
}
Loading

0 comments on commit b2e9d52

Please sign in to comment.