Skip to content

Commit

Permalink
Add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
rmoff committed Feb 11, 2021
1 parent 1b5f5cc commit e627e02
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 23 deletions.
16 changes: 16 additions & 0 deletions introduction-to-ksqldb/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
= Introduction to ksqlDB
Robin Moffatt <robin@confluent.io>
v1.00, 11 February 2021

This repository contains two (TWO!) demos that you can use to explore ksqlDB.

* link:demo_introduction_to_ksqldb_01.adoc[Demo 01] is based on the movement of people
** 🎥 https://www.youtube.com/watch?v=7mGBxG2NhVQ[Recording]
* link:demo_introduction_to_ksqldb_02.adoc[Demo 02] uses generated order data
Both are run using the same Docker Compose file. See each demo script (linked above) for how to run them.

''''

Got questions? https://confluent.io/community/ask-the-community/[Join the Confluent Community] to get help and assist others :)
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 4 additions & 10 deletions introduction-to-ksqldb/demo_introduction_to_ksqldb_01.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
= Introduction to ksqlDB - demo script
= Introduction to ksqlDB - demo script 01
Robin Moffatt <robin@confluent.io>
v1.00, 13 May 2020
v1.10, 10 February 2021
:toc:

== Running the test rig
Expand Down Expand Up @@ -232,8 +232,8 @@ Add some more data into Kafka topic, show postgres updating in place.

[source,sql]
----
INSERT INTO MOVEMENTS (ROWTIME, ROWKEY, LOCATION) VALUES (STRINGTOTIMESTAMP('2020-02-17T15:22:00Z','yyyy-MM-dd''T''HH:mm:ssX'), 'robin', 'Leeds');
INSERT INTO MOVEMENTS (ROWTIME, ROWKEY, LOCATION) VALUES (STRINGTOTIMESTAMP('2020-02-17T16:22:00Z','yyyy-MM-dd''T''HH:mm:ssX'), 'robin', 'Retford');
INSERT INTO MOVEMENTS (ROWTIME, PERSON, LOCATION) VALUES (STRINGTOTIMESTAMP('2020-02-17T15:22:00Z','yyyy-MM-dd''T''HH:mm:ssX'), 'robin', 'Leeds');
INSERT INTO MOVEMENTS (ROWTIME, PERSON, LOCATION) VALUES (STRINGTOTIMESTAMP('2020-02-17T16:22:00Z','yyyy-MM-dd''T''HH:mm:ssX'), 'robin', 'Retford');
----

=== Deploying code via REST API
Expand All @@ -254,9 +254,3 @@ docker exec -t ksqldb curl -s -X "POST" "http://localhost:8088/ksql" \
}
}'
----

=== TODO

* TODO add in datagen
* TODO INSERT INTO to merge streams

34 changes: 21 additions & 13 deletions introduction-to-ksqldb/demo_introduction_to_ksqldb_02.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# An introduction to KSQL
Robin Moffatt <robin@confluent.io>
v1.10, 17 September 2019
v1.20, 11 February 2021
:toc:

## Setup
Expand All @@ -19,7 +19,7 @@ _The first time that you do this, the Docker images will be pulled down from the
+
[source,bash]
----
cd ksql-intro
cd introduction-to-ksqldb
docker-compose up -d
----
Expand All @@ -39,7 +39,7 @@ docker exec -it ksqldb bash -c 'echo -e "\n\n⏳ Waiting for KSQL to be availabl
----
SHOW TOPICS;
PRINT 'orders';
PRINT orders;
CREATE STREAM ORDERS WITH
(VALUE_FORMAT='AVRO',
Expand Down Expand Up @@ -148,7 +148,8 @@ image::images/join01.png[]

[source,sql]
----
PRINT 'item_details_01' LIMIT 10;
PRINT 'item_details_01' FROM BEGINNING LIMIT 10;
CREATE TABLE ITEM_REFERENCE_01 (ITEM_ID VARCHAR PRIMARY KEY)
WITH (VALUE_FORMAT='AVRO',
Expand All @@ -171,6 +172,7 @@ SELECT TIMESTAMPTOSTRING(O.ROWTIME, 'yyyy-MM-dd HH:mm:ss') AS ORDER_TIMESTAMP,
EMIT CHANGES
LIMIT 5;
SET 'auto.offset.reset' = 'earliest';
CREATE STREAM ORDERS_ENRICHED AS
SELECT O.ROWTIME AS ORDER_TIMESTAMP,
O.ORDERID,
Expand Down Expand Up @@ -208,19 +210,25 @@ Check that the connector is `RUNNING`

[source,sql]
----
ksql> show connectors;
DESCRIBE CONNECTOR SINK_ELASTIC_ORDERS_01;
----

[source,sql]
----
Name : SINK_ELASTIC_ORDERS_01
Class : io.confluent.connect.elasticsearch.ElasticsearchSinkConnector
Type : sink
State : RUNNING
WorkerId : ksqldb:8083
Connector Name | Type | Class | Status
---------------------------------------------------------------------------------------------------------------------------------------
SINK_ELASTIC_ORDERS_01 | SINK | io.confluent.connect.elasticsearch.ElasticsearchSinkConnector | RUNNING (1/1 tasks RUNNING)
source-datagen-item_details_01 | SOURCE | io.confluent.kafka.connect.datagen.DatagenConnector | WARNING (0/1 tasks RUNNING)
source-datagen-orders-us | SOURCE | io.confluent.kafka.connect.datagen.DatagenConnector | RUNNING (1/1 tasks RUNNING)
source-datagen-orders-uk | SOURCE | io.confluent.kafka.connect.datagen.DatagenConnector | RUNNING (1/1 tasks RUNNING)
---------------------------------------------------------------------------------------------------------------------------------------
Task ID | State | Error Trace
---------------------------------
0 | RUNNING |
---------------------------------
----

View in http://localhost:5601/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!f,value:2000),time:(from:now-15m,to:now))&_a=(columns:!(_source),filters:!(),index:orders_enriched,interval:auto,query:(language:kuery,query:''),sort:!())[Kibana]

View in http://localhost:5601/app/kibana#/management/kibana/index?_g=()[Kibana]

''''

Expand Down

0 comments on commit e627e02

Please sign in to comment.