summaryrefslogtreecommitdiff
path: root/pkg/pubsub/psmessage.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/pubsub/psmessage.go')
-rw-r--r--pkg/pubsub/psmessage.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/pkg/pubsub/psmessage.go b/pkg/pubsub/psmessage.go
new file mode 100644
index 00000000..e33d9284
--- /dev/null
+++ b/pkg/pubsub/psmessage.go
@@ -0,0 +1,15 @@
+package pubsub
+
+import json "github.com/json-iterator/go"
+
+// Message represents a single message with payload bound to a particular topic
+type Message struct {
+ // Topic (channel in terms of redis)
+ Topic string `json:"topic"`
+ // Payload (on some decode stages might be represented as base64 string)
+ Payload []byte `json:"payload"`
+}
+
+func (m *Message) MarshalBinary() (data []byte, err error) {
+ return json.Marshal(m)
+}