-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathproject-commands.sh
executable file
·54 lines (43 loc) · 1.16 KB
/
project-commands.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/zsh
# After broker container start to install tree
# apt-get update && apt-get install tree
# To get a shell on the broker container
function docker-shell() {
docker exec -it broker /bin/bash
}
function broker-logs() {
docker logs broker
}
function sr-logs() {
docker logs schema-registy
}
function get-subjects() {
curl -s "http://localhost:8081/subjects" | jq
}
function get-version() {
if [ -z "$1" ];
then echo "You need to supply the subject-name"
return
fi
curl -s "http://localhost:8081/subjects/{$1}/versions" | jq
}
function get-latest-schema() {
if [ -z "$1" ];
then echo "You need to supply the subject-name"
return
fi
curl -s "http://localhost:8081/subjects/{$1}/versions/latest" | jq '.'
}
function consume() {
if [ -z "$1" ];
then echo "Must supply a topic name"
return
fi
echo "Starting to consume from $1"
docker exec -it broker kafka-console-consumer --bootstrap-server localhost:9092\
--from-beginning --property print.key=true --property key.separator="-" --topic "$1"
}
function list-topics() {
echo "Kafka topics:"
docker exec -it broker kafka-topics --list --bootstrap-server localhost:9092
}