Example #1
0
// Queue the message in the given topic
func (m *Message) Queue(topic *pubsub.Topic) error {
	data, err := json.Marshal(m)
	if err != nil {
		return err
	}
	msgIds, err := topic.Publish(context.Background(), &pubsub.Message{
		Data: data,
	})
	if err != nil {
		return err
	}

	glog.Infof("Published to topic (%s): %s", topic.String(), msgIds)

	return nil
}