Skip to content

Instantly share code, notes, and snippets.

@hodrigohamalho
Last active January 20, 2020 12:57
Show Gist options
  • Save hodrigohamalho/f9cd917f6a592b56de6eb76a8a5d7789 to your computer and use it in GitHub Desktop.
Save hodrigohamalho/f9cd917f6a592b56de6eb76a8a5d7789 to your computer and use it in GitHub Desktop.
AMQ Streams Demo

AMQ Streams (Aka Strimzi) (Aka Kafka on Kubernetes)

Setup

To use another project different than myproject (livedemo)

sed -i '' 's/namespace: .*/namespace: livedemo/' install/cluster-operator/*RoleBinding*.yaml

Cluster Deployment

unzip amq-streams-1.2.0-ocp-install-examples.zip
oc replace --force -f examples/templates/cluster-operator/ -n openshift
oc replace --force -f install/cluster-operator/
oc new-app strimzi-ephemeral

Topics

Creating a Topic (Kafka Like)

oc exec -it my-cluster-zookeeper-0 -- bin/kafka-topics.sh --zookeeper localhost:21810 --list
oc exec -it my-cluster-zookeeper-0 -- bin/kafka-topics.sh --zookeeper localhost:21810 --describe
oc exec -it my-cluster-zookeeper-0 -- bin/kafka-topics.sh --zookeeper localhost:21810 --create --topic created-in-kafka --partitions 1 --replication-factor 1

Creating a Topic (Kubernetes Like)

oc get kafka
oc create -f examples/topic/kafka-topic.yaml

Producing and Consuming Messages

oc create -f https://raw.githubusercontent.com/scholzj/demo-amq-streams-webinar/master/08-my-user.yaml
oc create -f https://raw.githubusercontent.com/scholzj/demo-amq-streams-webinar/master/09-demo-application.yaml

IoT Demo

oc create -f ./stream-app/resources/topics.yml
oc create -f ./stream-app/resources/stream-app.yml
oc get kafkaTopics
oc create -f ./consumer-app/resources/consumer-app.yml
oc create -f ./device-app/resources/device-app.yml

After some while, scale consumer-app to 0, reset the offset and scale up:

oc exec -it my-cluster-zookeeper-0 -- bin/kafka-consumer-groups.sh --bootstrap-server my-cluster-kafka-bootstrap:9092 --group consumer-app --reset-offsets --to-earliest --all-topics --execute

3D vision

Demo video:

https://drive.google.com/file/d/1eU11392hadTqxR6oMrZvvXlLnke75Hse/view

Source code:

https://gitlab.com/appdev-demos/camel-kafka-vr

Adjust the following files:

src/main/fabric8/swagger-std-route.yml
src/main/fabric8/topicview-route.yml
src/main/resources/application.properties

Event Sourcing

open http://analytic-ui-sko.apps.ramalho.openshiftworkshop.com/
oc rsh kafka-0
cd bin
./kafka-consumer-groups.sh --bootstrap-server kafka:9092 --group analyticgroup --reset-offsets --to-earliest --all-topics --execute
./kafka-consumer-groups.sh --bootstrap-server kafka:9092 --group analyticgroup --describe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment