diff --git a/main.go b/main.go index dbf323c..dba32bb 100644 --- a/main.go +++ b/main.go @@ -4,9 +4,6 @@ import ( "context" "encoding/json" "fmt" - "github.com/alexandrevicenzi/go-sse" - "github.com/gobuffalo/packr" - "gopkg.in/yaml.v2" "html/template" "io/ioutil" "log" @@ -16,6 +13,10 @@ import ( "strings" "sync" + "github.com/alexandrevicenzi/go-sse" + "github.com/gobuffalo/packr" + "gopkg.in/yaml.v2" + "cloud.google.com/go/pubsub" ) @@ -192,7 +193,7 @@ func pullMessages(ctx context.Context, subscription *pubsub.Subscription, topic cctx, _ := context.WithCancel(ctx) err := subscription.Receive(cctx, func(ctx context.Context, msg *pubsub.Message) { msg.Ack() - log.Printf("Project [%s], topic [%s], subscription [%s], got message: %q\n", project, topic.ID(), subscription.ID(), string(msg.Data)) + log.Printf("Project [%s], topic [%s], subscription [%s], got message: %q, with attributes: %v\n", project, topic.ID(), subscription.ID(), string(msg.Data), msg.Attributes) topicID := fmt.Sprintf("%s/%s", project, topic.ID()) messages[topicID] = append([]pubsub.Message{*msg}, messages[topicID]...) diff --git a/static/templates/main.html b/static/templates/main.html index fddb69c..6a56c87 100644 --- a/static/templates/main.html +++ b/static/templates/main.html @@ -19,11 +19,22 @@
-
- {{ "{{ atob(message.Data) }}" }}
-
-
+
+
+ {{ "{{ atob(message.Data) }}" }}
+
+
+
+
+ {{ "{{ message.Attributes }}" }}
+
+
+ No messages yet ðŸ“