Closed metacoma closed 3 months ago
MVP code (values for vector/vector helm chart)
customConfig:
data_dir: /vector-data-dir
api:
enabled: true
address: 127.0.0.1:8686
playground: false
sources:
http_server:
address: 0.0.0.0:6000
encoding: json
path: /event
type: http_server
#NAME TOPICS BOOTSTRAPSERVERS READY REASON AGE
#context-broker-team-a-source ["team-a-cdc-topic"] ["neo4j-cdc.redpanda:9093"] True 23h
neo4j-cdc:
type: kafka
bootstrap_servers: "neo4j-cdc.redpanda:9093"
group_id: team-a-vector
#key_field: message_key
topics:
- team-a-cdc-topic
decoding:
codec: json
librdkafka_options:
api.version.request: 'true'
partition.assignment.strategy: roundrobin
log_level: '6'
session.timeout.ms: '10000'
max.poll.interval.ms: '300000'
socket.nagle.disable: 'false'
socket.keepalive.enable: 'true'
socket.max.fails: '3'
fetch.min.bytes: '1000000'
sinks:
stdout:
type: console
inputs: [http_server,neo4j-cdc]
encoding:
codec: json
context-broker:
type: http
inputs: [http_server,neo4j-cdc]
encoding:
codec: json
uri: http://broker-ingress.knative-eventing.svc.cluster.local/context-team-a/context-broker-team-a
request:
concurrency: 1
headers:
"Content-Type": "application/json"
"Ce-Id": "1234"
"Ce-Specversion": "1.0"
"Ce-Type": "{{`{{ .meta.operation }}`}}" # XXX verctor doesn't support this
"Ce-Source": "/mycontext"
image:
repository: timberio/vector
tag: 0.26.0-alpine
service:
enabled: true
ports:
- name: aggregator
port: 31399
protocol: TCP
targetPort: 31399
- name: http-server
port: 6000
protocol: TCP
targetPort: 31398
type: ClusterIP
serviceHeadless:
enabled: false
image:
repository: timberio/vector
#tag: 0.26.0-alpine
tag: 0.38.0-alpine
service:
enabled: true
ports:
- name: aggregator
port: 31399
protocol: TCP
targetPort: 31399
- name: http-server
port: 6000
protocol: TCP
targetPort: 31398
type: ClusterIP
serviceHeadless:
enabled: false
But unfortunately, vector doesn't support templating inside http.request.header values, more details here: https://github.com/vectordotdev/vector/issues/201
A simple data converter between Neo4j CDC Kafka topic data format and Knative broker data format (CloudEvent)
customConfig:
data_dir: /vector-data-dir
transforms:
cloudevent:
type: "lua"
version: "2"
inputs:
- neo4j-cdc
hooks:
process: process
source: |
function process(event, emit)
local cloudevent = {}
cloudevent.log = {
id = "4051f0cc-2761-11ef-b43c-3b4c0580692a",
data = event.log,
source = "graph",
specversion = "1.0",
datacontenttype = "application/json",
type = "created",
--type = event.log["meta"]["operations"],
--time = os.date("!%Y-%m-%dT%H:%M:%SZ", os.time()),
traceparent = "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01",
tracestate = "rojo=00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01,congo=lZWRzIHRoNhcm5hbCBwbGVhc3VyZS4"
}
emit(cloudevent)
end
api:
enabled: true
address: 127.0.0.1:8686
playground: false
sources:
http_server:
address: 0.0.0.0:6000
encoding: json
path: /event
type: http_server
#NAME TOPICS BOOTSTRAPSERVERS READY REASON AGE
#context-broker-team-a-source ["team-a-cdc-topic"] ["neo4j-cdc.redpanda:9093"] True 23h
neo4j-cdc:
type: kafka
bootstrap_servers: "neo4j-cdc.redpanda:9093"
group_id: team-a-vector
#key_field: message_key
topics:
- team-a-cdc-topic
decoding:
codec: json
librdkafka_options:
api.version.request: 'true'
partition.assignment.strategy: roundrobin
log_level: '6'
session.timeout.ms: '10000'
max.poll.interval.ms: '300000'
socket.nagle.disable: 'false'
socket.keepalive.enable: 'true'
socket.max.fails: '3'
fetch.min.bytes: '1000000'
sinks:
stdout:
type: console
inputs: [cloudevent]
encoding:
codec: json
test:
type: http
inputs: [cloudevent]
encoding:
codec: json
method: post
batch:
max_size: 1
max_events: 1
framing:
method: "newline_delimited"
#uri: http://broker-ingress.knative-eventing.svc.cluster.local/context-team-a/context-broker-team-a
uri: https://knative.requestcatcher.com/test
request:
concurrency: 1
headers:
"Content-Type": "application/cloudevents+json"
context-broker:
type: http
inputs: [cloudevent]
encoding:
codec: json
method: post
batch:
max_size: 1
max_events: 1
framing:
method: "newline_delimited"
uri: http://broker-ingress.knative-eventing.svc.cluster.local/context-team-a/context-broker-team-a
request:
concurrency: 1
headers:
"Content-Type": "application/cloudevents+json"
CDC new node event
Payload:
CDC relationship new event
payload