mirror of
https://github.com/aljazceru/cyphernode.git
synced 2025-12-18 05:05:12 +01:00
First draft of the pub/sub notifier
This commit is contained in:
38
notifier_docker/script/requesthandler.sh
Normal file
38
notifier_docker/script/requesthandler.sh
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./trace.sh
|
||||
. ./web.sh
|
||||
. ./response.sh
|
||||
|
||||
main() {
|
||||
trace "Entering main()..."
|
||||
|
||||
local msg
|
||||
local cmd
|
||||
local response
|
||||
local response_topic
|
||||
|
||||
while read msg; do
|
||||
trace "[main] msg=${msg}"
|
||||
|
||||
cmd=$(echo ${msg} | jq ".cmd" | tr -d '"')
|
||||
trace "[main] cmd=${cmd}"
|
||||
|
||||
response_topic=$(echo ${msg} | jq '."response-topic"' | tr -d '"')
|
||||
trace "[main] response_topic=${response_topic}"
|
||||
|
||||
case "${cmd}" in
|
||||
web)
|
||||
response=$(web "${msg}")
|
||||
publish_response "${response}" "${response_topic}" ${?}
|
||||
trace "[main] PR"
|
||||
;;
|
||||
esac
|
||||
trace "[main] case finished"
|
||||
done
|
||||
}
|
||||
|
||||
export TRACING=1
|
||||
|
||||
main
|
||||
exit $?
|
||||
Reference in New Issue
Block a user