Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Unified Diff: go/src/infra/tricium/service/workflow-listener/handlers.go

Issue 2125603002: Adds initial Tricium service GAE configs (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Adds optional display of the request form Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: go/src/infra/tricium/service/workflow-listener/handlers.go
diff --git a/go/src/infra/tricium/service/workflow-listener/handlers.go b/go/src/infra/tricium/service/workflow-listener/handlers.go
new file mode 100644
index 0000000000000000000000000000000000000000..4c777a993a7d4379e08f8fe665eb8188e6213fb5
--- /dev/null
+++ b/go/src/infra/tricium/service/workflow-listener/handlers.go
@@ -0,0 +1,37 @@
+package handlers
+
+import (
+ "html/template"
+ "net/http"
+
+ "appengine"
+ "appengine/taskqueue"
+)
+
+func init() {
+ http.HandleFunc("/workflow-listener/status", statusPageHandler)
+ http.HandleFunc("/workflow-listener/queue-handler", queueHandler)
+}
+
+var basePage = template.Must(template.ParseFiles("templates/base.html"))
+
+func statusPageHandler(w http.ResponseWriter, r *http.Request) {
+ // TODO(emso): Add workflow listener stats
+ data := map[string]interface{}{
+ "Msg": "Status of the Workflow Listener ...",
+ }
+ basePage.Execute(w, data)
+}
+
+func queueHandler(w http.ResponseWriter, r *http.Request) {
+ ctx := appengine.NewContext(r)
+
+ // TODO(emso): Process task (find LogDog streams to listen to) and listen to events.
+
+ // Enqueue gerrit reporter task.
+ t := taskqueue.NewPOSTTask("/gerrit-reporter/queue-handler", map[string][]string{"name": {"Workflow Event"}})
+ if _, err := taskqueue.Add(ctx, t, "gerrit-reporter-queue"); err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698