Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
WIP
  • Loading branch information
akrambek committed Oct 2, 2024
commit 38b7050cd1d0d6fbe2eb167e311e4316ffcbffb6
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,73 @@ write zilla:data.ext ${pgsql:dataEx()
.query()
.build()
.build()}
write "CREATE TABLE IF NOT EXISTS cities (\n"
" *,\n"
" PRIMARY KEY (id)\n"
")\n"
"INCLUDE KEY AS key\n"
"INCLUDE header 'zilla:correlation-id' AS correlation_id\n"
"INCLUDE timestamp AS timestamp\n"
"INCLUDE header 'zilla:identity' AS owner_id\n"
"WITH (\n"
" connector='kafka',\n"
" properties.bootstrap.server='localhost:9092',\n"
" topic='dev.cities',\n"
" scan.startup.mode='latest',\n"
" scan.startup.timestamp.millis='140000000'\n"
") FORMAT PLAIN ENCODE AVRO (\n"
" schema.registry = 'http://localhost:8081'\n"
");"
write "CREATE SOURCE IF NOT EXISTS cities_source (*)\n"
"INCLUDE header 'zilla:correlation-id' AS zilla_correlation_id_header,\n"
"INCLUDE timestamp AS timestamp,\n"
"INCLUDE header 'zilla:identity' AS zilla_identity_header,\n"
"WITH (\n"
" connector='kafka',\n"
" properties.bootstrap.server='localhost:9092',\n"
" topic='dev.cities',\n"
" scan.startup.mode='latest',\n"
" scan.startup.timestamp.millis='140000000'\n"
") FORMAT PLAIN ENCODE AVRO (\n"
" schema.registry = 'http://localhost:8081'\n"
");"
[0x00]
write flush

read advised zilla:flush ${pgsql:flushEx()
.typeId(zilla:id("pgsql"))
.completion()
.tag("CREATE_SOURCE")
.build()
.build()}

read advised zilla:flush ${pgsql:flushEx()
.typeId(zilla:id("pgsql"))
.ready()
.status("IDLE")
.build()
.build()}

write zilla:data.ext ${pgsql:dataEx()
.typeId(zilla:id("pgsql"))
.query()
.build()
.build()}
write "CREATE MATERIALIZED VIEW cities_view AS\n"
" SELECT id, name, description,"
" COALESCE(correlation_id, zilla_correlation_id_header::varchar) as correlation_id,"
" COALESCE(identity, zilla_identity_header::varchar) as identity,
" timestamp FROM cities_source;"
[0x00]
write flush

read advised zilla:flush ${pgsql:flushEx()
.typeId(zilla:id("pgsql"))
.completion()
.tag("CREATE_MATERIALIZED_VIEW")
.build()
.build()}

read advised zilla:flush ${pgsql:flushEx()
.typeId(zilla:id("pgsql"))
.ready()
.status("IDLE")
.build()
.build()}

write zilla:data.ext ${pgsql:dataEx()
.typeId(zilla:id("pgsql"))
.query()
.build()
.build()}
write "CREATE TABLE IF NOT EXISTS cities "
"(id VARCHAR, name VARCHAR, description VARCHAR,"
" correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP,"
" PRIMARY KEY (id));"
[0x00]
write flush

read advised zilla:flush ${pgsql:flushEx()
Expand All @@ -67,12 +115,65 @@ read advised zilla:flush ${pgsql:flushEx()
.build()
.build()}

write zilla:data.ext ${pgsql:dataEx()
.typeId(zilla:id("pgsql"))
.query()
.build()
.build()}
write "CREATE SINK cities_view_sink INTO cities FROM cities_view;"
[0x00]
write flush

read advised zilla:flush ${pgsql:flushEx()
.typeId(zilla:id("pgsql"))
.completion()
.tag("CREATE_SINK")
.build()
.build()}

read advised zilla:flush ${pgsql:flushEx()
.typeId(zilla:id("pgsql"))
.ready()
.status("IDLE")
.build()
.build()}

write zilla:data.ext ${pgsql:dataEx()
.typeId(zilla:id("pgsql"))
.query()
.build()
.build()}
write "CREATE SINK cities_sink\n"
"FROM cities\n"
"WITH (\n"
" connector='kafka',\n"
" topic='dev.cities',\n"
" properties.bootstrap.server='localhost:9092',\n"
" primary_key='id'\n
") FORMAT UPSERT ENCODE AVRO (\n"
" schema.registry = 'http://localhost:8081'\n"
");"
[0x00]
write flush

read advised zilla:flush ${pgsql:flushEx()
.typeId(zilla:id("pgsql"))
.completion()
.tag("CREATE_SINK")
.build()
.build()}

read advised zilla:flush ${pgsql:flushEx()
.typeId(zilla:id("pgsql"))
.ready()
.status("IDLE")
.build()
.build()}

connect "zilla://streams/app2"
option zilla:window 8192
option zilla:transmission "duplex"


write zilla:begin.ext ${pgsql:beginEx()
.typeId(zilla:id("pgsql"))
.parameter("user", "root")
Expand All @@ -89,7 +190,9 @@ write zilla:data.ext ${pgsql:dataEx()
.build()
.build()}
write "CREATE TOPIC IF NOT EXISTS cities "
"(id VARCHAR, name VARCHAR, description VARCHAR, PRIMARY KEY (id));"
"(id VARCHAR, name VARCHAR, description VARCHAR,"
" correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP,"
" PRIMARY KEY (id));"
[0x00]
write flush

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ read zilla:data.ext ${pgsql:dataEx()
.query()
.build()
.build()}
read "CREATE MATERIALIZED VIEW cities_view AS SELECT * FROM cities_source;"
[0x00]
read "CREATE MATERIALIZED VIEW cities_view AS\n"
" SELECT id, name, description,"
" COALESCE(correlation_id, zilla_correlation_id_header::varchar) as correlation_id,"
Expand Down Expand Up @@ -171,7 +169,6 @@ write advise zilla:flush ${pgsql:flushEx()
.build()
.build()}


accept "zilla://streams/app2"
option zilla:window 8192
option zilla:transmission "duplex"
Expand All @@ -195,7 +192,7 @@ read zilla:data.ext ${pgsql:dataEx()
.build()}
read "CREATE TOPIC IF NOT EXISTS cities "
"(id VARCHAR, name VARCHAR, description VARCHAR,"
" correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP"
" correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP,"
" PRIMARY KEY (id));"
[0x00]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ write advise zilla:flush ${pgsql:flushEx()
.build()
.build()}


accept "zilla://streams/app2"
option zilla:window 8192
option zilla:transmission "duplex"
Expand Down
Loading