// PublishAnchor publishes the anchor to the queue for processing.
PublishAnchor publishes the anchor to the queue for processing.
// PublishAnchor publishes the anchor to the queue for processing .
func (h *PubSub) PublishAnchor(anchorInfo *anchorinfo.AnchorInfo) error {
	if h.State() != lifecycle.StateStarted {
		return lifecycle.ErrNotStarted
	}
	payload, err := h.jsonMarshal(anchorInfo)
	if err != nil {
		return fmt.Errorf("publish anchorInfo: %w", err)
	}
	msg := message.NewMessage(watermill.NewUUID(), payload)
	logger.Debugf("Publishing anchors message [%s] to topic [%s]: %s", msg.UUID, anchorTopic, msg.Payload)
	err = h.publisher.Publish(anchorTopic, msg)
	if err != nil {
		logger.Warnf("Error publishing anchors message [%s] to topic [%s]: %s", msg.UUID, anchorTopic, err)
		return errors.NewTransient(err)
	}
	logger.Debugf("Successfully published anchors message [%s] to topic [%s]: %s",
		msg.UUID, anchorTopic, msg.Payload)
	return nil
}
func ( h * PubSub ) PublishAnchor ( anchorInfo * anchorinfo . AnchorInfo ) error { if h . State ( ) != lifecycle . StateStarted { return lifecycle . ErrNotStarted } payload , err := h . jsonMarshal ( anchorInfo ) if err != nil { return fmt . Errorf ( " " , err ) } msg := message . NewMessage ( watermill . NewUUID ( ) , payload ) logger . Debugf ( " " , msg . UUID , anchorTopic , msg . Payload ) err = h . publisher . Publish ( anchorTopic , msg ) if err != nil { logger . Warnf ( " " , msg . UUID , anchorTopic , err ) return errors . NewTransient ( err ) } logger . Debugf ( " " , msg . UUID , anchorTopic , msg . Payload ) return nil }
PublishAnchor publishes the anchor to the queue for processing.
PublishAnchor publishes the anchor to the queue for processing .